annotate runtime/autoload/netrw.vim @ 2472:3567e0d56891 vim73

Updated version of gettext for use with MVC. (Mike Williams)
author Bram Moolenaar <bram@vim.org>
date Mon, 02 Aug 2010 21:43:29 +0200
parents e52d87a2bb3e
children b0d34143ebfc
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
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3 " Date: Jul 27, 2010
2426
e52d87a2bb3e More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2420
diff changeset
4 " Version: 140
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
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
7 " Copyright: Copyright (C) 1999-2010 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
2426
e52d87a2bb3e More runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 2420
diff changeset
25 let g:loaded_netrw = "v140"
2034
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)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
156 call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
157 call s:NetrwInit("g:netrw_chgwin" , -1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
158 call s:NetrwInit("g:netrw_compress" , "gzip")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
159 call s:NetrwInit("g:netrw_ctags" , "ctags")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
160 if !exists("g:netrw_cursorline")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
161 let g:netrw_cursorline= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
162 let s:netrw_usercul = &cursorline
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
163 let s:netrw_usercuc = &cursorcolumn
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
164 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
165 " Default values - d-g ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
166 call s:NetrwInit("g:netrw_dirhist_cnt" , 0)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
167 call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
168 call s:NetrwInit("g:netrw_dirhistmax" , 10)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
169 call s:NetrwInit("g:netrw_fastbrowse" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
170 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
171 if !exists("g:netrw_ftp_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
172 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
173 let g:netrw_ftp_list_cmd = "ls -lF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
174 let g:netrw_ftp_timelist_cmd = "ls -tlF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
175 let g:netrw_ftp_sizelist_cmd = "ls -slF"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
176 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
177 let g:netrw_ftp_list_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
178 let g:netrw_ftp_timelist_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
179 let g:netrw_ftp_sizelist_cmd = "dir"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
180 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
181 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
182 call s:NetrwInit("g:netrw_ftpmode",'binary')
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
183 " Default values - h-lh ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
184 call s:NetrwInit("g:netrw_hide",1)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
185 if !exists("g:netrw_ignorenetrc")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
186 if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
187 let g:netrw_ignorenetrc= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
188 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
189 let g:netrw_ignorenetrc= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
190 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
191 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
192 call s:NetrwInit("g:netrw_keepdir",1)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
193 if !exists("g:netrw_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
194 if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
195 " provide a 'pscp' listing command
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
196 if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
197 let g:netrw_scp_cmd ="pscp -i C:\\private.ppk"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
198 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
199 let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
200 elseif executable(g:netrw_ssh_cmd)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
201 " provide a default listing command
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
202 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
203 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
204 " call Decho(g:netrw_ssh_cmd." is not executable")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
205 let g:netrw_list_cmd= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
206 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
207 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
208 call s:NetrwInit("g:netrw_list_hide","")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
209 " Default values - lh-lz ---------- {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
210 if !exists("g:netrw_localcopycmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
211 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
212 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
213 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
214 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
215 let g:netrw_localcopycmd= "copy"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
216 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
217 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
218 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
219 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
220 let g:netrw_localcopycmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
221 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
222 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
223 call s:NetrwInit("g:netrw_local_mkdir","mkdir")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
224 if !exists("g:netrw_localmovecmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
225 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
226 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
227 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
228 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
229 let g:netrw_localmovecmd= "move"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
230 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
231 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
232 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
233 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
234 let g:netrw_localmovecmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
235 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
236 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
237 call s:NetrwInit("g:netrw_local_rmdir", "rmdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
238 call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
239 " sanity checks
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
240 if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
241 let g:netrw_liststyle= s:THINLIST
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
242 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
243 if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
244 let g:netrw_list_cmd= g:netrw_list_cmd." -l"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
245 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
246 " Default values - m-r ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
247 call s:NetrwInit("g:netrw_markfileesc" , '*./[\~')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
248 call s:NetrwInit("g:netrw_maxfilenamelen", 32)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
249 call s:NetrwInit("g:netrw_menu" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
250 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
251 call s:NetrwInit("g:netrw_mousemaps" , (exists("&mouse") && &mouse =~ '[anh]'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
252 call s:NetrwInit("g:netrw_retmap" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
253 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
254 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
255 elseif has("win32") || has("win95") || has("win64") || has("win16")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
256 call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
257 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
258 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
259 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
260 call s:NetrwInit("g:netrw_preview" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
261 call s:NetrwInit("g:netrw_scpport" , "-P")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
262 call s:NetrwInit("g:netrw_sshport" , "-p")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
263 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
264 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
265 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
266 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
267 " Default values - s ---------- {{{3
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
268 " 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
269 call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
270 call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "silent keepj " : "keepj ")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
271 call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
272 call s:NetrwInit("g:netrw_sort_options" , "")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
273 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
274 if !exists("g:netrw_sort_sequence")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
275 if has("unix")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
276 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
277 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
278 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
279 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
280 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
281 call s:NetrwInit("g:netrw_special_syntax" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
282 call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
283 call s:NetrwInit("g:netrw_use_noswf" , 0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
284 " Default values - t-w ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
285 call s:NetrwInit("g:netrw_timefmt","%c")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
286 call s:NetrwInit("g:netrw_xstrlen",0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
287 call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
288 call s:NetrwInit("g:netrw_use_errorwindow",1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
289 call s:NetrwInit("g:netrw_win95ftp",1)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
290 call s:NetrwInit("g:netrw_winsize",25)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
291 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
292 " Default values for netrw's script variables: {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
293 call s:NetrwInit("g:netrw_fname_escape",' ?&;%')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
294 if has("win32") || has("win95") || has("win64") || has("win16")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
295 call s:NetrwInit("g:netrw_glob_escape",'[]*?`{$')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
296 else
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
297 call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$\')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
298 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
299 call s:NetrwInit("g:netrw_menu_escape",'./&? \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
300 call s:NetrwInit("g:netrw_tmpfile_escape",' &;')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
301 call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
302
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
303 " BufEnter event ignored by decho when following variable is true
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
304 " Has a side effect that doau BufReadPost doesn't work, so
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
305 " files read by network transfer aren't appropriately highlighted.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
306 "let g:decho_bufenter = 1 "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
307
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
308 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
309 " Netrw Utility Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
310 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
311
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
312 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
313 " s:NetrwOptionSave: save options and set to "standard" form {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
314 " 06/08/07 : removed call to NetrwSafeOptions(), either placed
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
315 " immediately after NetrwOptionSave() calls in NetRead
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
316 " and NetWrite, or after the s:NetrwEnew() call in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
317 " NetrwBrowse.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
318 " vt: normally its "w:" or "s:" (a variable type)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
319 fun! s:NetrwOptionSave(vt)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
320 " 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
321
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
322 " 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
323 if !exists("{a:vt}netrw_optionsave")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
324 let {a:vt}netrw_optionsave= 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
325 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
326 " call Dret("s:NetrwOptionSave : options already saved")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
327 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
328 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
329 " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
330
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
331 " Save current settings and current directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
332 let s:yykeep = @@
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
333 if exists("&l:acd")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
334 let {a:vt}netrw_acdkeep = &l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
335 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
336 let {a:vt}netrw_aikeep = &l:ai
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
337 let {a:vt}netrw_awkeep = &l:aw
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
338 let {a:vt}netrw_bombkeep = &l:bomb
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
339 let {a:vt}netrw_cikeep = &l:ci
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
340 let {a:vt}netrw_cinkeep = &l:cin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
341 let {a:vt}netrw_cinokeep = &l:cino
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
342 let {a:vt}netrw_comkeep = &l:com
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
343 let {a:vt}netrw_cpokeep = &l:cpo
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
344 let {a:vt}netrw_diffkeep = &l:diff
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
345 if g:netrw_keepdir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
346 let {a:vt}netrw_dirkeep = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
347 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
348 let {a:vt}netrw_fokeep = &l:fo " formatoptions
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
349 let {a:vt}netrw_gdkeep = &l:gd " gdefault
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
350 let {a:vt}netrw_hidkeep = &l:hidden
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
351 let {a:vt}netrw_imkeep = &l:im
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
352 let {a:vt}netrw_magickeep = &l:magic
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
353 let {a:vt}netrw_repkeep = &l:report
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
354 let {a:vt}netrw_selkeep = &l:sel
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
355 let {a:vt}netrw_spellkeep = &l:spell
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
356 let {a:vt}netrw_twkeep = &l:tw " textwidth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
357 let {a:vt}netrw_wigkeep = &l:wig " wildignore
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
358 if has("win32") && !has("win95")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
359 let {a:vt}netrw_swfkeep = &l:swf " swapfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
360 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
361 if &go =~ 'a' | silent! let {a:vt}netrw_regstar = @* | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
362 silent! let {a:vt}netrw_regslash= @/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
363
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
364 " call Dret("s:NetrwOptionSave : win#".winnr()." buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
365 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
366
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
367 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
368 " s:NetrwOptionRestore: restore options {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
369 fun! s:NetrwOptionRestore(vt)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
370 " 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
371 if !exists("{a:vt}netrw_optionsave")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
372 " 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
373 " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
374 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
375 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
376 unlet {a:vt}netrw_optionsave
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
377
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
378 if exists("&acd")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
379 if exists("{a:vt}netrw_acdkeep")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
380 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
381 let curdir = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
382 let &l:acd = {a:vt}netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
383 unlet {a:vt}netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
384 if &l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
385 " 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
386 try
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
387 if !exists("&l:acd") && !&l:acd
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
388 exe 'keepj lcd '.fnameescape(curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
389 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
390 catch /^Vim\%((\a\+)\)\=:E472/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
391 call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".curdir."> (permissions?)",61)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
392 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
393 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
394 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
395 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
396 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
397 if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
398 if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
399 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
400 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
401 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
402 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
403 if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
404 if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
405 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
406 let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
407 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
408 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
409 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
410 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
411 if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
412 if exists("{a:vt}netrw_imkeep") |let &l:im = {a:vt}netrw_imkeep |unlet {a:vt}netrw_imkeep |endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
413 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
414 if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
415 if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
416 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
417 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
418 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
419 if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
420 if exists("{a:vt}netrw_swfkeep")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
421 if &directory == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
422 " user hasn't specified a swapfile directory;
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
423 " netrw will temporarily set the swapfile directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
424 " to the current directory as returned by getcwd().
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
425 let &l:directory = getcwd()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
426 silent! let &l:swf = {a:vt}netrw_swfkeep
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
427 setlocal directory=
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
428 unlet {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
429 elseif &l:swf != {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
430 " 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
431 silent! let &l:swf= {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
432 unlet {a:vt}netrw_swfkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
433 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
434 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
435 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
436 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
437
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
438 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
439 " 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
440 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
441 " call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
442 " call Dret("s:NetrwOptionRestore : win#".winnr()." buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
443 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
444
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
445 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
446 " s:NetrwSafeOptions: sets options to help netrw do its job {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
447 fun! s:NetrwSafeOptions()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
448 " 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
449 " call Decho("win#".winnr()."'s ft=".&ft)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
450 setlocal cino=
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
451 setlocal com=
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
452 setlocal cpo-=aA
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
453 if exists("&acd") | setlocal noacd | endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
454 setlocal nocin noai nobomb noci magic nospell nohid wig= noaw noim
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
455 setlocal fo=nroql2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
456 setlocal tw=0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
457 setlocal report=10000
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
458 setlocal isk+=@ isk+=* isk+=/
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
459 setlocal sel=inclusive
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
460 if g:netrw_use_noswf && has("win32") && !has("win95")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
461 setlocal noswf
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
462 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
463 call s:NetrwCursorline()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
464
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
465 " allow the user to override safe options
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
466 " call Decho("ft<".&ft."> ei=".&ei)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
467 if &ft == "netrw"
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
468 " call Decho("do any netrw FileType autocmds")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
469 silent keepalt keepjumps doau FileType netrw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
470 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
471
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
472 " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
473 " call Dret("s:NetrwSafeOptions")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
474 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
475
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
476 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
477 " netrw#NetrwClean: remove netrw {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
478 " supports :NetrwClean -- remove netrw from first directory on runtimepath
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
479 " :NetrwClean! -- remove netrw from all directories on runtimepath
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
480 fun! netrw#NetrwClean(sys)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
481 " call Dfunc("netrw#NetrwClean(sys=".a:sys.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
482
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
483 if a:sys
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
484 let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
485 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
486 let choice= confirm("Remove personal copy of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
487 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
488 " call Decho("choice=".choice)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
489 let diddel= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
490 let diddir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
491
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
492 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
493 for dir in split(&rtp,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
494 if filereadable(dir."/plugin/netrwPlugin.vim")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
495 " call Decho("removing netrw-related files from ".dir)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
496 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
497 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
498 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
499 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
500 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
501 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
502 let diddir= dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
503 let diddel= diddel + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
504 if !a:sys|break|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
505 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
506 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
507 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
508
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
509 echohl WarningMsg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
510 if diddel == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
511 echomsg "netrw is either not installed or not removable"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
512 elseif diddel == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
513 echomsg "removed one copy of netrw from <".diddir.">"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
514 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
515 echomsg "removed ".diddel." copies of netrw"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
516 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
517 echohl None
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
518
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
519 " call Dret("netrw#NetrwClean")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
520 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
521
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
522 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
523 " netrw#Nread: {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
524 fun! netrw#Nread(mode,fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
525 " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
526 call netrw#NetrwSavePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
527 call netrw#NetRead(a:mode,a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
528 call netrw#NetrwRestorePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
529 " call Dret("netrw#Nread")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
530 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
531
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
532 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
533 " Netrw Transfer Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
534 " ===============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
535
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
536 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
537 " netrw#NetRead: responsible for reading a file over the net {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
538 " mode: =0 read remote file and insert before current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
539 " =1 read remote file and insert after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
540 " =2 replace with remote file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
541 " =3 obtain file, but leave in temporary format
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
542 fun! netrw#NetRead(mode,...)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
543 " 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
544
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
545 " NetRead: save options {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
546 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
547 call s:NetrwSafeOptions()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
548 call s:RestoreCursorline()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
549
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
550 " NetRead: interpret mode into a readcmd {{{3
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
551 if a:mode == 0 " read remote file before current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
552 let readcmd = "0r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
553 elseif a:mode == 1 " read file after current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
554 let readcmd = "r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
555 elseif a:mode == 2 " replace with remote file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
556 let readcmd = "%r"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
557 elseif a:mode == 3 " skip read of file (leave as temporary)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
558 let readcmd = "t"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
559 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
560 exe a:mode
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
561 let readcmd = "r"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
563 let ichoice = (a:0 == 0)? 0 : 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
564 " call Decho("readcmd<".readcmd."> ichoice=".ichoice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
565
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
566 " NetRead: get temporary filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
567 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
568 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
569 " call Dret("netrw#NetRead : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
570 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
571 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
572
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
573 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
574
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
575 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
576 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
577 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
578 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
579 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
580
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
581 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
582 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
583 " call Decho("no lastfile: choice<" . choice . ">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
584
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
585 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
586 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
587 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
588 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
589 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
590 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
591 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
592 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
593 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
594 echomsg ':Nread http://[user@]machine/path uses http wget'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
595 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
596 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
597 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
598 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
599 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
600 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
601
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
602 elseif match(choice,'^"') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
603 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
604 " call Decho("reconstructing choice")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
605 if match(choice,'"$') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
606 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
607 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
608 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
609 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
610 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
611 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
612
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
613 while match(choice,'"$') == -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
614 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
615 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
616 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
617 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
618 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
619 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
620 " call Dret("netrw#NetRead :2 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
621 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
622 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
623 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
624 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
625 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
626 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
627 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
628 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
629
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
630 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
631 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
632
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
633 " NetRead: Determine method of read (ftp, rcp, etc) {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
634 call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
635 if !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
636 " call Dfunc("netrw#NetRead : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
637 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
638 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
639 let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
640
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
641 " Check if NetrwBrowse() should be handling this request
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
642 " 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
643 if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^http://'
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
644 " call Decho("yes, choice matches '^.*[\/]$'")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
645 keepj call s:NetrwBrowse(0,choice)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
646 " call Dret("netrw#NetRead :3 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
647 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
648 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
649
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
650 " ============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
651 " NetRead: Perform Protocol-Based Read {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
652 " ===========================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
653 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
654 echo "(netrw) Processing your read request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
655 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
656
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
657 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
658 " NetRead: (rcp) NetRead Method #1 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
659 if b:netrw_method == 1 " read with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
660 " call Decho("read via rcp (method #1)")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
661 " ER: nothing done with g:netrw_uid yet?
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
662 " ER: on Win2K" rcp machine[.user]:file tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
663 " ER: if machine contains '.' adding .user is required (use $USERNAME)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
664 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
665 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
666 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
667 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
668 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
669 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
670 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
671 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
672 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
673 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
674 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
675 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
676 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
677 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
678 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
679 " 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
680 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
681 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
682 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
683
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
684 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
685 " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
686 elseif b:netrw_method == 2 " read with ftp + <.netrc>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
687 " call Decho("read via ftp+.netrc (method #2)")
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
688 let netrw_fname= b:netrw_fname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
689 call s:SaveBufVars()|new|call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
690 let filtbuf= bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
691 setlocal ff=unix
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
692 keepj put =g:netrw_ftpmode
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
693 " call Decho("filter input: ".getline(line("$")))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
694 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
695 keepj put =g:netrw_ftpextracmd
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
696 " call Decho("filter input: ".getline(line("$")))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
697 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
698 call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
699 " call Decho("filter input: ".getline(line("$")))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
700 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
701 " 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
702 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
703 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
704 " 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
705 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
706 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
707 " 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
708 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
709 let debugkeep = &debug
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
710 setlocal debug=msg
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
711 call netrw#ErrorMsg(s:ERROR,getline(1),4)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
712 let &debug = debugkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
713 endif
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
714 call s:SaveBufVars()
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
715 bd!
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
716 if bufname("%") == "" && getline("$") == "" && line('$') == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
717 " 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
718 q!
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
719 endif
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
720 call s:RestoreBufVars()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
721 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
722 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
723
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
724 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
725 " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
726 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
727 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
728 " call Decho("read via ftp+mipf (method #3)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
729 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
730 call s:SaveBufVars()|new|call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
731 let filtbuf= bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
732 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
733 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
734 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
735 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
736 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
737 keepj put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
738 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
739 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
740
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
741 if exists("g:netrw_ftp") && g:netrw_ftp == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
742 keepj put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
743 " call Decho("filter input: ".getline('.'))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
744 keepj put ='\"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
745 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
746 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
747 keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
748 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
749 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
750
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
751 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
752 keepj put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
753 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
754 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
755 if exists("g:netrw_ftpextracmd")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
756 put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
757 " call Decho("filter input: ".getline('.'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
758 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
759 keepj put ='get \"'.netrw_fname.'\" '.tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
760 " call Decho("filter input: ".getline('.'))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
761
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
762 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
763 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
764 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
765 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
766 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
767 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
768 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
769 " 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
770 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
771 " call Decho("error<".getline(1).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
772 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
773 call netrw#ErrorMsg(s:ERROR,getline(1),5)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
774 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
775 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
776 call s:SaveBufVars()|bd!|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
777 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
778 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
779
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
780 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
781 " NetRead: (scp) NetRead Method #4 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
782 elseif b:netrw_method == 4 " read with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
783 " call Decho("read via scp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
784 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
785 let useport= " ".g:netrw_scpport." ".g:netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
786 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
787 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
788 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
789 " 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
790 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
791 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
792 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
793
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
794 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
795 " NetRead: (http) NetRead Method #5 (wget) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
796 elseif b:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
797 " call Decho("read via http (method #5)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
798 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
799 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
800 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
801 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
802 " call Dret("netrw#NetRead :4 getcwd<".getcwd().">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
803 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
804 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
805
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
806 if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
807 " 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
808 " 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
809 if exists("g:netrw_http_xcmd")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
810 " 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
811 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
812 else
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
813 " 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
814 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
815 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
816 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
817
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
818 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
819 " 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
820 " 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
821 let netrw_html= substitute(b:netrw_fname,"#.*$","","")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
822 let netrw_tag = substitute(b:netrw_fname,"^.*#","","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
823 " call Decho("netrw_html<".netrw_html.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
824 " call Decho("netrw_tag <".netrw_tag.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
825 " 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
826 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
827 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
828 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
829 exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
830 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
831 let b:netrw_lastfile = choice
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
832 setlocal ro
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
833
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
834 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
835 " NetRead: (dav) NetRead Method #6 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
836 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
837 " call Decho("read via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
838
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
839 if !executable(g:netrw_dav_cmd)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
840 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
841 " call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
842 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
843 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
844 if g:netrw_dav_cmd =~ "curl"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
845 " 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
846 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
847 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
848 " Construct execution string (four lines) which will be passed through filter
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
849 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
850 new
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
851 setlocal ff=unix
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
852 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
853 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
854 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
855 keepj put ='open '.g:netrw_machine
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
856 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
857 keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
858 keepj put ='get '.netrw_fname.' '.tmpfile
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
859 keepj put ='quit'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
860
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
861 " perform cadaver operation:
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
862 keepj norm! 1Gdd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
863 " call Decho("executing: %!".g:netrw_dav_cmd)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
864 exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
865 bd!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
866 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
867 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
868 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
869
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
870 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
871 " NetRead: (rsync) NetRead Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
872 elseif b:netrw_method == 7
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
873 " call Decho("read via rsync (method #7)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
874 " 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
875 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
876 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
877 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
878
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
879 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
880 " NetRead: (fetch) NetRead Method #8 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
881 " fetch://[user@]host[:http]/path
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
882 elseif b:netrw_method == 8
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
883 " call Decho("read via fetch (method #8)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
884 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
885 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
886 call netrw#ErrorMsg(s:ERROR,"fetch command not available",7)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
887 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
888 " call Dret("NetRead")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
889 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
890 if exists("g:netrw_option") && g:netrw_option == ":http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
891 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
892 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
893 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
894 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
895 " call Decho("read via fetch for ".netrw_option)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
896
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
897 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
898 " 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
899 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
900 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
901 " 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
902 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
903 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
904
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
905 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
906 let b:netrw_lastfile = choice
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
907 setlocal ro
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
908
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
909 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
910 " NetRead: (sftp) NetRead Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
911 elseif b:netrw_method == 9
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
912 " call Decho("read via sftp (method #9)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
913 " 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
914 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
915 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
916 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
917
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
918 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
919 " NetRead: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
920 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
921 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
922 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
923 endwhile
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 " NetRead: cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
926 if exists("b:netrw_method")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
927 " call Decho("cleanup b:netrw_method and b:netrw_fname")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
928 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
929 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
930 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
931 if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
932 " call Decho("cleanup by deleting tmpfile<".tmpfile.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
933 call s:NetrwDelete(tmpfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
934 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
935 call s:NetrwOptionRestore("w:")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
936
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
937 " call Dret("netrw#NetRead :5 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
938 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
939
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
940 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
941 " netrw#NetWrite: responsible for writing a file over the net {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
942 fun! netrw#NetWrite(...) range
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
943 " call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
944
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
945 " NetWrite: option handling {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
946 let mod= 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
947 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
948 call s:NetrwSafeOptions()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
949
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
950 " NetWrite: Get Temporary Filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
951 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
952 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
953 " call Dret("netrw#NetWrite : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
954 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
955 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
956
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
957 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
958 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
959 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
960 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
961 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
962
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
963 let curbufname= expand("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
964 " call Decho("curbufname<".curbufname.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
965 if &binary
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
966 " For binary writes, always write entire file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
967 " (line numbers don't really make sense for that).
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
968 " Also supports the writing of tar and zip files.
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
969 " call Decho("(write entire file) silent exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
970 exe "silent keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
971 elseif g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
972 " write (selected portion of) file to temporary
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
973 let cygtmpfile= substitute(tmpfile,'/cygdrive/\(.\)','\1:','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
974 " call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
975 exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
976 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
977 " write (selected portion of) file to temporary
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
978 " call Decho("(write selected portion) silent exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
979 exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
980 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
981
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
982 if curbufname == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
983 " 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
984 " on the temporary file's name. Deletion of the temporary file during
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
985 " cleanup then causes an error message.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
986 0file!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
987 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
988
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
989 " NetWrite: while choice loop: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
990 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
991
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
992 " Process arguments: {{{4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
993 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
994 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
995 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
996 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
997 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
998 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
999 exe "let choice= a:" . ichoice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1000
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1001 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1002 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1003 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1004 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1005 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1006 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1007 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1008 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1009 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1010 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1011 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1012 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1013 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1014 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1015 break
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1016
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1017 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1018 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1019 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1020 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1021 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1022 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1023 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1024 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1025
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1026 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1027 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1028 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1029 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1030 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1031 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1032 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1033 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1034 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1035 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1036 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1037 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1038 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1039 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1040 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1041 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1042 let ichoice= ichoice + 1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1043 " call Decho("choice<" . choice . "> ichoice=".ichoice)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1044
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1045 " Determine method of write (ftp, rcp, etc) {{{4
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1046 call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1047 if !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1048 " call Dfunc("netrw#NetWrite : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1049 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1050 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1051
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1052 " =============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1053 " NetWrite: Perform Protocol-Based Write {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1054 " ============================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1055 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1056 echo "(netrw) Processing your write request..."
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1057 " call Decho("(netrw) Processing your write request...")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1058 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1059
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1060 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1061 " NetWrite: (rcp) NetWrite Method #1 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1062 if b:netrw_method == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1063 " call Decho("write via rcp (method #1)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1064 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1065 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1066 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1067 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1068 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1069 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1070 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1071 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1072 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1073 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1074 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1075 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1076 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1077 " 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
1078 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
1079 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1080
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1081 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1082 " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1083 elseif b:netrw_method == 2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1084 " call Decho("write via ftp+.netrc (method #2)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1085 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1086
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1087 " 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
1088 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1089 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1090 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1091 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1092
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1093 " call Decho("filter input window#".winnr())
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1094 setlocal ff=unix
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1095 keepj put =g:netrw_ftpmode
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1096 " call Decho("filter input: ".getline('$'))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1097 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1098 keepj put =g:netrw_ftpextracmd
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1099 " call Decho("filter input: ".getline("$"))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1100 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1101 call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"')
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1102 " call Decho("filter input: ".getline("$"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1103 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1104 " 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
1105 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
1106 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1107 " call Decho("filter input window#".winnr())
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1108 " 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
1109 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
1110 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1111 " 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
1112 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1113 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1114 call netrw#ErrorMsg(s:ERROR,getline(1),14)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1115 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1116 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1117 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1118
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1119 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1120 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1121 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1122 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1123 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1124
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1125 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1126
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1127 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1128 " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1129 elseif b:netrw_method == 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1130 " 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
1131 " call Decho("read via ftp+mipf (method #3)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1132 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1133 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1134
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1135 " 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
1136 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1137 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1138 enew
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1139 setlocal ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1140
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1141 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1142 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1143 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1144 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1145 keepj put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1146 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1147 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1148 if exists("g:netrw_ftp") && g:netrw_ftp == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1149 keepj put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1150 " call Decho("filter input: ".getline('.'))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1151 keepj put ='\"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1152 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1153 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1154 keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1155 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1156 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1157 keepj put =g:netrw_ftpmode
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1158 " call Decho("filter input: ".getline('$'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1159 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1160 keepj put =g:netrw_ftpextracmd
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1161 " call Decho("filter input: ".getline("$"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1162 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1163 keepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1164 " call Decho("filter input: ".getline('.'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1165 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1166 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1167
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1168 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1169 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1170 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1171 " -n win32: quit being obnoxious about password
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1172 keepj norm! 1Gdd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1173 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1174 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1175 " 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
1176 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1177 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1178 call netrw#ErrorMsg(s:ERROR,getline(1),15)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1179 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1180 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1181 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1182
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1183 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1184 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1185 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1186 let &l:bh= bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1187 exe filtbuf."bw!"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1188
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1189 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1190 " NetWrite: (scp) NetWrite Method #4 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1191 elseif b:netrw_method == 4
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1192 " call Decho("write via scp (method #4)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1193 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1194 let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1195 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1196 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1197 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1198 " 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
1199 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
1200 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1201
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1202 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1203 " NetWrite: (http) NetWrite Method #5 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1204 elseif b:netrw_method == 5
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1205 " call Decho("write via http (method #5)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1206 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1207 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
1208 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1209
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1210 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1211 " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1212 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1213 " call Decho("write via cadaver (method #6)")
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 " 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
1216 let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1217 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1218
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1219 " 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
1220 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1221 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1222 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1223
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1224 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1225 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1226 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1227 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1228 keepj put ='open '.g:netrw_machine
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1229 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1230 if exists("g:netrw_uid") && exists("s:netrw_passwd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1231 keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1232 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1233 keepj put ='put '.tmpfile.' '.netrw_fname
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1234
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1235 " perform cadaver operation:
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1236 keepj norm! 1Gdd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1237 " call Decho("executing: %!".g:netrw_dav_cmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1238 exe s:netrw_silentxfer."%!".g:netrw_dav_cmd
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1239
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1240 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1241 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1242 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1243 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1244 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1245
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1246 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1247
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1248 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1249 " NetWrite: (rsync) NetWrite Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1250 elseif b:netrw_method == 7
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1251 " call Decho("write via rsync (method #7)")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1252 " 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
1253 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
1254 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1255
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1256 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1257 " NetWrite: (sftp) NetWrite Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1258 elseif b:netrw_method == 9
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1259 " call Decho("read via sftp (method #9)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1260 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1261 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1262 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1263 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1264 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1265 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1266
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1267 " 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
1268 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1269 let curbuf = bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1270 setlocal bh=hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1271 enew
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1272
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1273 setlocal ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1274 call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1275 " call Decho("filter input: ".getline('.'))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1276 " call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1277 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
1278 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1279 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1280 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1281 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1282 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1283
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1284 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1285 " NetWrite: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1286 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1287 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1288 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1289 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1290
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1291 " NetWrite: Cleanup: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1292 " call Decho("cleanup")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1293 if s:FileReadable(tmpfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1294 " call Decho("tmpfile<".tmpfile."> readable, will now delete it")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1295 call s:NetrwDelete(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1296 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1297 call s:NetrwOptionRestore("w:")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1298
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1299 if a:firstline == 1 && a:lastline == line("$")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1300 " restore modifiability; usually equivalent to set nomod
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1301 let &mod= mod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1302 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1303
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1304 " restore equalalways
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1305 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1306 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1307
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1308 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1309 " netrw#NetSource: source a remotely hosted vim script {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1310 " uses NetRead to get a copy of the file into a temporarily file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1311 " then sources that file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1312 " then removes that file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1313 fun! netrw#NetSource(...)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1314 " call Dfunc("netrw#NetSource() a:0=".a:0)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1315 if a:0 > 0 && a:1 == '?'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1316 " give help
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1317 echomsg 'NetSource Usage:'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1318 echomsg ':Nsource dav://machine[:port]/path uses cadaver'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1319 echomsg ':Nsource fetch://machine/path uses fetch'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1320 echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1321 echomsg ':Nsource http://[user@]machine/path uses http wget'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1322 echomsg ':Nsource rcp://[user@]machine/path uses rcp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1323 echomsg ':Nsource rsync://machine[:port]/path uses rsync'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1324 echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1325 echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1326 sleep 4
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1327 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1328 let i= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1329 while i <= a:0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1330 call netrw#NetRead(3,a:{i})
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1331 " call Decho("(netrw#NetSource) s:netread_tmpfile<".s:netrw_tmpfile.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1332 if s:FileReadable(s:netrw_tmpfile)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1333 " call Decho("(netrw#NetSource) exe so ".fnameescape(s:netrw_tmpfile))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1334 exe "so ".fnameescape(s:netrw_tmpfile)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1335 " call Decho("(netrw#NetSource) delete(".s:netrw_tmpfile.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1336 call delete(s:netrw_tmpfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1337 unlet s:netrw_tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1338 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1339 call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1340 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1341 let i= i + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1342 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1343 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1344 " call Dret("netrw#NetSource")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1345 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1346
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1347 " ===========================================
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1348 " s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1349 " readcmd == %r : replace buffer with newly read file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1350 " == 0r : read file at top of buffer
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1351 " == r : read file after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1352 " == t : leave file in temporary form (ie. don't read into buffer)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1353 fun! s:NetrwGetFile(readcmd, tfile, method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1354 " call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1355
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1356 " readcmd=='t': simply do nothing
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1357 if a:readcmd == 't'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1358 " 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
1359 " call Dret("NetrwGetFile : skip read of <".a:tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1360 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1361 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1362
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1363 " get name of remote filename (ie. url and all)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1364 let rfile= bufname("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1365 " call Decho("rfile<".rfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1366
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1367 if exists("*NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1368 " for the use of NetReadFixup (not otherwise used internally)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1369 let line2= line("$")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1370 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1371
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1372 if a:readcmd[0] == '%'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1373 " get file into buffer
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1374 " call Decho("get file into buffer")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1375
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1376 " rename the current buffer to the temp file (ie. tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1377 if g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1378 let tfile= substitute(a:tfile,'/cygdrive/\(.\)','\1:','')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1379 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1380 let tfile= a:tfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1381 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1382 " call Decho("exe sil! keepalt file ".fnameescape(tfile))
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1383 exe "sil! keepalt file ".fnameescape(tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1384
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1385 " edit temporary file (ie. read the temporary file in)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1386 if rfile =~ '\.zip$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1387 " call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1388 call zip#Browse(tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1389 elseif rfile =~ '\.tar$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1390 " call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1391 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1392 elseif rfile =~ '\.tar\.gz$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1393 " call Decho("handling remote gzip-compressed tar file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1394 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1395 elseif rfile =~ '\.tar\.bz2$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1396 " call Decho("handling remote bz2-compressed tar file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1397 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1398 elseif rfile =~ '\.tar\.xz$'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1399 " call Decho("handling remote xz-compressed tar file")
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1400 call tar#Browse(tfile)
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1401 elseif rfile =~ '\.txz$'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1402 " call Decho("handling remote xz-compressed tar file (.txz)")
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1403 call tar#Browse(tfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1404 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1405 " call Decho("edit temporary file")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1406 e!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1407 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1408
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1409 " rename buffer back to remote filename
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
1410 " call Decho("exe sil! keepalt file ".fnameescape(rfile))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1411 exe "sil! keepalt file ".fnameescape(rfile)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1412 filetype detect
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1413 " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1414 let line1 = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1415 let line2 = line("$")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1416
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1417 elseif s:FileReadable(a:tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1418 " read file after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1419 " call Decho("read file<".a:tfile."> after current line")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1420 let curline = line(".")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1421 let lastline= line("$")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1422 " 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
1423 exe a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1424 let line1= curline + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1425 let line2= line("$") - lastline + 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1426
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1427 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1428 " not readable
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1429 " 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
1430 " call Decho("tfile<".a:tfile."> not readable")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1431 call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1432 " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1433 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1434 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1435
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1436 " User-provided (ie. optional) fix-it-up command
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1437 if exists("*NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1438 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1439 call NetReadFixup(a:method, line1, line2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1440 " else " Decho
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1441 " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")")
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1442 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1443
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1444 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
1445 " update the Buffers menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1446 call s:UpdateBuffersMenu()
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1447 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
1448
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1449 " 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
1450
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1451 " make sure file is being displayed
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1452 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1453
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1454 " 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
1455 " call Dret("NetrwGetFile")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1456 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1457
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1458 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1459 " s:NetrwMethod: determine method of transfer {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1460 " Input:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1461 " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1462 " Output:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1463 " b:netrw_method= 1: rcp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1464 " 2: ftp + <.netrc>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1465 " 3: ftp + machine, id, password, and [path]filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1466 " 4: scp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1467 " 5: http (wget)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1468 " 6: dav
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1469 " 7: rsync
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1470 " 8: fetch
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1471 " 9: sftp
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1472 " g:netrw_machine= hostname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1473 " b:netrw_fname = filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1474 " g:netrw_port = optional port number (for ftp)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1475 " g:netrw_choice = copy of input url (choice)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1476 fun! s:NetrwMethod(choice)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1477 " call Dfunc("NetrwMethod(a:choice<".a:choice.">)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1478
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1479 " record current g:netrw_machine, if any
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1480 " curmachine used if protocol == ftp and no .netrc
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1481 if exists("g:netrw_machine")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1482 let curmachine= g:netrw_machine
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1483 " call Decho("curmachine<".curmachine.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1484 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1485 let curmachine= "N O T A HOST"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1486 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1487
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1488 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1489 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1490 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1491 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1492 let g:netrw_port = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1493 let g:netrw_choice = a:choice
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1494
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1495 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1496 " mipf : a:machine a:id password filename Use ftp
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1497 " 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
1498 " 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
1499 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1500 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1501 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1502 " httpurm : http://[user@]host/filename Use wget
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1503 " davurm : dav[s]://host[:port]/path Use cadaver/curl
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1504 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1505 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1506 " sftpurm : sftp://[user@]host/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1507 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1508 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1509 let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1510 let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1511 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1512 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1513 let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1514 let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1515 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1516 let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1517 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1518
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1519 " call Decho("determine method:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1520 " Determine Method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1521 " rcp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1522 if match(a:choice,rcpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1523 " call Decho("rcp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1524 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1525 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1526 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1527 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1528 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1529 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1530 endif
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 " scp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1533 elseif match(a:choice,scpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1534 " call Decho("scp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1535 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1536 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1537 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1538 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1539
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1540 " http://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1541 elseif match(a:choice,httpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1542 " call Decho("http://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1543 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1544 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1545 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1546
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1547 " dav://hostname[:port]/..path-to-file..
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1548 elseif match(a:choice,davurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1549 " call Decho("dav://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1550 let b:netrw_method= 6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1551 if a:choice =~ '^s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1552 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1553 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1554 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1555 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1556 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1557
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1558 " rsync://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1559 elseif match(a:choice,rsyncurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1560 " call Decho("rsync://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1561 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1562 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1563 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1564
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1565 " ftp://[user@]hostname[[:#]port]/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1566 elseif match(a:choice,ftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1567 " call Decho("ftp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1568 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1569 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1570 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1571 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1572 " call Decho("g:netrw_machine<".g:netrw_machine.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1573 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1574 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1575 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1576 if exists("s:netrw_passwd") && curmachine != g:netrw_machine
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1577 " if there's a change in hostname, require password re-entry
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1578 unlet s:netrw_passwd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1579 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1580 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
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 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1583 if s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1584 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1585 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1586 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1587 call NetUserPass()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1588 elseif !exists("s:netrw_passwd") || s:netrw_passwd == ""
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1589 call NetUserPass(g:netrw_uid)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1590 " else just use current g:netrw_uid and s:netrw_passwd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1591 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1592 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1593 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1594 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1595
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1596 elseif match(a:choice,fetchurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1597 " call Decho("fetch://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1598 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1599 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1600 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1601 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1602 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1603
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1604 " Issue an ftp : "machine id password [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1605 elseif match(a:choice,mipf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1606 " call Decho("(ftp) host id pass file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1607 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1608 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1609 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1610 let s:netrw_passwd = substitute(a:choice,mipf,'\3',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1611 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1612
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1613 " Issue an ftp: "hostname [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1614 elseif match(a:choice,mf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1615 " call Decho("(ftp) host file")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1616 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1617 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1618 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1619 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1620
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1621 elseif s:FileReadable(expand("$HOME/.netrc"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1622 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1623 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1624 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1625 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1626
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1627 " sftp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1628 elseif match(a:choice,sftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1629 " call Decho("sftp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1630 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1631 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1632 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1633
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1634 " Issue an rcp: hostname:filename" (this one should be last)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1635 elseif match(a:choice,rcphf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1636 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1637 let b:netrw_method = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1638 let userid = substitute(a:choice,rcphf,'\2',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1639 let g:netrw_machine = substitute(a:choice,rcphf,'\3',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1640 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1641 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1642 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1643 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1644 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1645 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1646 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1647 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1648
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1649 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1650 if !exists("g:netrw_quiet")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1651 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
1652 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1653 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1654 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1655
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1656 " remove any leading [:#] from port number
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1657 if g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1658 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1659 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1660
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1661 " call Decho("a:choice <".a:choice.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1662 " call Decho("b:netrw_method <".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1663 " call Decho("g:netrw_machine<".g:netrw_machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1664 " call Decho("g:netrw_port <".g:netrw_port.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1665 " if exists("g:netrw_uid") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1666 " call Decho("g:netrw_uid <".g:netrw_uid.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1667 " endif "Decho
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1668 " if exists("s:netrw_passwd") "Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1669 " call Decho("s:netrw_passwd <".s:netrw_passwd.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1670 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1671 " call Decho("b:netrw_fname <".b:netrw_fname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1672 " call Dret("NetrwMethod : b:netrw_method=".b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1673 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1674
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1675 " ------------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1676 " NetReadFixup: this sort of function is typically written by the user {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1677 " to handle extra junk that their system's ftp dumps
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1678 " into the transfer. This function is provided as an
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1679 " example and as a fix for a Windows 95 problem: in my
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1680 " experience, win95's ftp always dumped four blank lines
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1681 " at the end of the transfer.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1682 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1683 fun! NetReadFixup(method, line1, line2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1684 " 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
1685
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1686 " sanity checks -- attempt to convert inputs to integers
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1687 let method = a:method + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1688 let line1 = a:line1 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1689 let line2 = a:line2 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1690 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
1691 " call Dret("NetReadFixup")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1692 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1693 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1694
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1695 if method == 3 " ftp (no <.netrc>)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1696 let fourblanklines= line2 - 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1697 if fourblanklines >= line1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1698 exe "sil keepj ".fourblanklines.",".line2."g/^\s*$/d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1699 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1700 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1701 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1702
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1703 " call Dret("NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1704 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1705 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1706
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1707 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1708 " NetUserPass: set username and password for subsequent ftp transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1709 " Usage: :call NetUserPass() -- will prompt for userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1710 " :call NetUserPass("uid") -- will prompt for password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1711 " :call NetUserPass("uid","password") -- sets global userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1712 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1713
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1714 " get/set userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1715 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1716 " call Dfunc("NetUserPass(a:0<".a:0.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1717 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1718 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1719 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1720 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1721 else " from command line
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1722 " call Dfunc("NetUserPass(a:1<".a:1.">)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1723 let g:netrw_uid= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1724 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1725
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1726 " get password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1727 if a:0 <= 1 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1728 " call Decho("a:0=".a:0." case <=1:")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1729 let s:netrw_passwd= inputsecret("Enter Password: ")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1730 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1731 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1732 let s:netrw_passwd=a:2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1733 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1734
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1735 " call Dret("NetUserPass")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1736 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1737
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1738 " ===========================================
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1739 " Shared Browsing Support: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1740 " ===========================================
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1741
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1742 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1743 " s:BrowserMaps: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1744 fun! s:BrowserMaps(islocal)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1745 " call Dfunc("s:BrowserMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1746 if a:islocal
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1747 " call Decho("make local maps")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1748 nnoremap <buffer> <silent> <cr> :call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1749 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
1750 nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1751 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
1752 nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1753 nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1754 nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1755 nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1756 nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1757 nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1758 nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1759 nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1760 nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1761 nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1762 nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1763 nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1764 nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1765 nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1766 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
1767 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
1768 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
1769 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
1770 nnoremap <buffer> <silent> c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1771 nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1772 nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("")<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1773 nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1774 nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1775 nnoremap <buffer> <silent> o :call <SID>NetrwSplit(3)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1776 nnoremap <buffer> <silent> O :call <SID>NetrwObtain(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1777 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
1778 nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1779 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
1780 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
1781 nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1782 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
1783 nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(1)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1784 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1785 nnoremap <buffer> <silent> t :call <SID>NetrwSplit(4)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1786 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
1787 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
1788 nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1789 nnoremap <buffer> <silent> v :call <SID>NetrwSplit(5)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1790 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
1791 nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1792 inoremap <buffer> <silent> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1793 inoremap <buffer> <silent> - <c-o>:exe "norm! 0"<bar>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,'../'))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1794 inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1795 inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1796 inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1797 inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1798 inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1799 inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1800 inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1801 inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1802 inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1803 inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1804 inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1805 inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1806 inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1807 inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1808 inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1809 inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1810 inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1811 inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1812 inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1813 inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1814 inoremap <buffer> <silent> c <c-o>:exe "keepjumps lcd ".fnameescape(b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1815 inoremap <buffer> <silent> C <c-o>:let g:netrw_chgwin= winnr()<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1816 inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("")<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1817 inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1818 inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1819 inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(3)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1820 inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1821 inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1822 inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1823 inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1824 inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1825 inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1826 inoremap <buffer> <silent> r <c-o>: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>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1827 inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1828 inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1829 inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(4)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1830 inoremap <buffer> <silent> T <c-o>:call <SID>NetrwSplit(4)<bar>norm! gT<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1831 inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1832 inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1833 inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(5)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1834 inoremap <buffer> <silent> x <c-o>:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1835 inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1836 if !hasmapto('<Plug>NetrwHideEdit')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1837 nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1838 imap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1839 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1840 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1841 if !hasmapto('<Plug>NetrwRefresh')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1842 nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1843 imap <buffer> <unique> <c-l> <Plug>NetrwRefresh
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1844 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1845 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
1846 if s:didstarstar || !mapcheck("<s-down>","n")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1847 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1848 inoremap <buffer> <silent> <s-down> :Nexplore<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1849 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1850 if s:didstarstar || !mapcheck("<s-up>","n")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1851 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1852 inoremap <buffer> <silent> <s-up> :Pexplore<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1853 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1854 let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape)
1621
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(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1857 nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1858 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
1859 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1860 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1861 inoremap <buffer> <silent> <leftmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1862 inoremap <buffer> <silent> <middlemouse> <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1863 inoremap <buffer> <silent> <s-leftmouse> <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1864 exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1865 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1866 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1867 exe 'nnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1868 exe 'nnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1869 exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetrwMakeDir("")<cr>'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1870 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1871 exe 'vnoremap <buffer> <silent> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1872 exe 'vnoremap <buffer> <silent> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1873 exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1874 exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1875 exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1876 exe 'inoremap <buffer> <silent> <Leader>m <c-o>:call <SID>NetrwMakeDir("")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1877 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1878
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1879 else " remote
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1880 " call Decho("make remote maps")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1881 call s:RemotePathAnalysis(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1882 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
1883 nnoremap <buffer> <silent> <c-l> :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1884 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
1885 nnoremap <buffer> <silent> a :call <SID>NetrwHide(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1886 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
1887 nnoremap <buffer> <silent> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1888 nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1889 nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1890 nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1891 nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1892 nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1893 nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1894 nnoremap <buffer> <silent> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1895 nnoremap <buffer> <silent> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1896 nnoremap <buffer> <silent> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1897 nnoremap <buffer> <silent> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1898 nnoremap <buffer> <silent> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1899 nnoremap <buffer> <silent> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1900 nnoremap <buffer> <silent> mx :<c-u>call <SID>NetrwMarkFileExe(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1901 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
1902 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
1903 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
1904 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
1905 nnoremap <buffer> <silent> C :let g:netrw_chgwin= winnr()<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1906 nnoremap <buffer> <silent> i :call <SID>NetrwListStyle(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1907 nnoremap <buffer> <silent> I :call <SID>NetrwBannerCtrl(1)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1908 nnoremap <buffer> <silent> o :call <SID>NetrwSplit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1909 nnoremap <buffer> <silent> O :call <SID>NetrwObtain(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1910 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
1911 nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(0)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1912 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
1913 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
1914 nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1915 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
1916 nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(0)<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1917 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1918 nnoremap <buffer> <silent> t :call <SID>NetrwSplit(1)<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1919 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
1920 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
1921 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
1922 nnoremap <buffer> <silent> v :call <SID>NetrwSplit(2)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1923 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
1924 nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(0)<cr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1925 inoremap <buffer> <silent> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1926 inoremap <buffer> <silent> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1927 inoremap <buffer> <silent> - <c-o>:exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'../'))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1928 inoremap <buffer> <silent> a <c-o>:call <SID>NetrwHide(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1929 inoremap <buffer> <silent> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1930 inoremap <buffer> <silent> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1931 inoremap <buffer> <silent> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1932 inoremap <buffer> <silent> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1933 inoremap <buffer> <silent> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1934 inoremap <buffer> <silent> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1935 inoremap <buffer> <silent> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1936 inoremap <buffer> <silent> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1937 inoremap <buffer> <silent> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1938 inoremap <buffer> <silent> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1939 inoremap <buffer> <silent> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1940 inoremap <buffer> <silent> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1941 inoremap <buffer> <silent> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1942 inoremap <buffer> <silent> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1943 inoremap <buffer> <silent> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1944 inoremap <buffer> <silent> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1945 inoremap <buffer> <silent> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_cur)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1946 inoremap <buffer> <silent> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1947 inoremap <buffer> <silent> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1948 inoremap <buffer> <silent> C <c-o>:let g:netrw_chgwin= winnr()<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1949 inoremap <buffer> <silent> i <c-o>:call <SID>NetrwListStyle(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1950 inoremap <buffer> <silent> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1951 inoremap <buffer> <silent> o <c-o>:call <SID>NetrwSplit(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1952 inoremap <buffer> <silent> O <c-o>:call <SID>NetrwObtain(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1953 inoremap <buffer> <silent> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1954 inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1955 inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1956 inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1957 inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1958 inoremap <buffer> <silent> r <c-o>: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>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1959 inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1960 inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1961 inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1962 inoremap <buffer> <silent> T <c-o>:call <SID>NetrwSplit(1)<bar>norm! gT<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1963 inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1964 inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1965 inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(2)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1966 inoremap <buffer> <silent> x <c-o>:call netrw#NetrwBrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1967 inoremap <buffer> <silent> % <c-o>:call <SID>NetrwOpenFile(0)<cr>
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1968 if !hasmapto('<Plug>NetrwHideEdit')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1969 nmap <buffer> <c-h> <Plug>NetrwHideEdit
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1970 imap <buffer> <c-h> <Plug>NetrwHideEdit
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1971 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1972 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1973 if !hasmapto('<Plug>NetrwRefresh')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1974 nmap <buffer> <c-l> <Plug>NetrwRefresh
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1975 imap <buffer> <c-l> <Plug>NetrwRefresh
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1976 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1977
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1978 let mapsafepath = escape(s:path, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1979 let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1980
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1981 nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1982 if g:netrw_mousemaps == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1983 nnoremap <buffer> <silent> <leftmouse> <leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1984 nnoremap <buffer> <silent> <middlemouse> <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1985 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
1986 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1987 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1988 inoremap <buffer> <silent> <leftmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1989 inoremap <buffer> <silent> <middlemouse> <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1990 inoremap <buffer> <silent> <s-leftmouse> <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1991 exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1992 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1993 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1994 exe 'nnoremap <buffer> <silent> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1995 exe 'nnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1996 exe 'nnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
1997 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1998 exe 'vnoremap <buffer> <silent> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1999 exe 'vnoremap <buffer> <silent> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2000 exe 'inoremap <buffer> <silent> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2001 exe 'inoremap <buffer> <silent> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2002 exe 'inoremap <buffer> <silent> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2003 exe 'inoremap <buffer> <silent> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2004 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2005 inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2006 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2007 call s:SetRexDir(a:islocal,b:netrw_curdir)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2008 " call Dret("s:BrowserMaps")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2009 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2010
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2011 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2012 " s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2013 fun! s:ExplorePatHls(pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2014 " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2015 let repat= substitute(a:pattern,'^**/\{1,2}','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2016 " call Decho("repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2017 let repat= escape(repat,'][.\')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2018 " call Decho("repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2019 let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2020 " call Dret("s:ExplorePatHls repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2021 return repat
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2022 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2023
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2024 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2025 " s:NetrwBookHistHandler: {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2026 " 0: (user: <mb>) bookmark current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2027 " 1: (user: <gb>) change to the bookmarked directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2028 " 2: (user: <qb>) list bookmarks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2029 " 3: (browsing) record current directory history
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2030 " 4: (user: <u>) go up (previous) bookmark
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2031 " 5: (user: <U>) go down (next) bookmark
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2032 " 6: (user: <mB>) delete bookmark
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2033 fun! s:NetrwBookHistHandler(chg,curdir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2034 " call Dfunc("s: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
2035
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2036 if a:chg == 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2037 " bookmark the current directory
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2038 " call Decho("(user: <b>) bookmark the current directory")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2039 if !exists("g:netrw_bookmarklist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2040 let g:netrw_bookmarklist= []
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 if index(g:netrw_bookmarklist,a:curdir) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2043 " curdir not currently in g:netrw_bookmarklist, so include it
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2044 call add(g:netrw_bookmarklist,a:curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2045 call sort(g:netrw_bookmarklist)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2046 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2047 echo "bookmarked the current directory"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2048
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2049 elseif a:chg == 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2050 " change to the bookmarked directory
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2051 " call Decho("(user: <".v:count."mb>) change to the bookmarked directory")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2052 if exists("g:netrw_bookmarklist[v:count-1]")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2053 exe "e ".fnameescape(g:netrw_bookmarklist[v:count-1])
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2054 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2055 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2056 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2057
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2058 elseif a:chg == 2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2059 " redraw!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2060 let didwork= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2061 " list user's bookmarks
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2062 " call Decho("(user: <q>) list user's bookmarks")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2063 if exists("g:netrw_bookmarklist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2064 " call Decho('list '.len(g:netrw_bookmarklist).' bookmarks')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2065 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2066 for bmd in g:netrw_bookmarklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2067 " call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1])
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2068 echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2069 let didwork = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2070 let cnt = cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2071 endfor
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2072 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2073
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2074 " list directory history
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2075 let cnt = g:netrw_dirhist_cnt
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2076 let first = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2077 let histcnt = 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2078 while ( first || cnt != g:netrw_dirhist_cnt )
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2079 " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2080 let histcnt= histcnt + 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2081 if exists("g:netrw_dirhist_{cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2082 " call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt})
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2083 echo "Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2084 let didwork= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2085 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2086 let first = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2087 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2088 if cnt < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2089 let cnt= cnt + g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2090 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2091 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2092 if didwork
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2093 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2094 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2095
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2096 elseif a:chg == 3
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2097 " saves most recently visited directories (when they differ)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2098 " call Decho("(browsing) record curdir history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2099 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
2100 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
2101 let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2102 " 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
2103 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2104
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2105 elseif a:chg == 4
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2106 " u: change to the previous directory stored on the history list
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2107 " call Decho("(user: <u>) chg to prev dir from history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2108 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
2109 if g:netrw_dirhist_cnt < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2110 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
2111 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2112 if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2113 " 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
2114 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
2115 setlocal ma noro
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2116 " call Decho("setlocal ma noro")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2117 keepj %d
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2118 setlocal nomod
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2119 " call Decho("setlocal nomod")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2120 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2121 " " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2122 exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2123 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2124 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
2125 echo "Sorry, no predecessor directory exists yet"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2126 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2127
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2128 elseif a:chg == 5
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2129 " U: change to the subsequent directory stored on the history list
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2130 " call Decho("(user: <U>) chg to next dir from history")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2131 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
2132 if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2133 " 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
2134 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
2135 setlocal ma noro
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2136 " call Decho("setlocal ma noro")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2137 keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2138 " call Decho("removed all lines from buffer (%d)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2139 setlocal nomod
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2140 " call Decho("setlocal nomod")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2141 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2142 " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2143 exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2144 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2145 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
2146 if g:netrw_dirhist_cnt < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2147 let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2148 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2149 echo "Sorry, no successor directory exists yet"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2150 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2151
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2152 elseif a:chg == 6
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2153 " delete the v:count'th bookmark
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2154 " 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
2155 let savefile= s:NetrwHome()."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2156 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2157 call s:NetrwBookHistSave() " done here to merge bookmarks first
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2158 call delete(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2159 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2160 call remove(g:netrw_bookmarklist,v:count-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2161 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2162 call s:NetrwBookmarkMenu()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2163 " call Dret("s:NetrwBookHistHandler")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2164 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2165
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2166 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2167 " s:NetrwBookHistRead: this function reads bookmarks and history {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2168 " Sister function: s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2169 fun! s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2170 " call Dfunc("s:NetrwBookHistRead()")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2171 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2172 let home = s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2173 let savefile= home."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2174 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2175 " call Decho("sourcing .netrwbook")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2176 exe "so ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2177 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2178 let savefile= home."/.netrwhist"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2179 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2180 " call Decho("sourcing .netrwhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2181 exe "so ".savefile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2182 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2183 let s:netrw_initbookhist= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2184 au VimLeave * call s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2185 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2186 " call Dret("s:NetrwBookHistRead")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2187 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2188
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2189 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2190 " s:NetrwBookHistSave: this function saves bookmarks and history {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2191 " Sister function: s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2192 " I used to do this via viminfo but that appears to
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2193 " be unreliable for long-term storage
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2194 " COMBAK: does $HOME work under windows???
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2195 fun! s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2196 " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2197 let savefile= s:NetrwHome()."/.netrwhist"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2198 1split
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2199 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2200 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
2201 setlocal nocin noai noci magic nospell nohid wig= noaw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2202 setlocal ma noro write
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2203 if exists("&acd") | setlocal noacd | endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2204 silent %d
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2205
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2206 " save .netrwhist -- no attempt to merge
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2207 silent! file .netrwhist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2208 call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2209 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
2210 let lastline = line("$")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2211 let cnt = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2212 while cnt <= g:netrw_dirhist_cnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2213 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
2214 let cnt= cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2215 endwhile
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2216 exe "sil! w! ".savefile
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2217
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2218 sil keepj %d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2219 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2220 " merge and write .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2221 let savefile= s:NetrwHome()."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2222
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2223 if filereadable(savefile)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2224 let booklist= deepcopy(g:netrw_bookmarklist)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2225 exe "sil keepj so ".savefile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2226 for bdm in booklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2227 if index(g:netrw_bookmarklist,bdm) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2228 call add(g:netrw_bookmarklist,bdm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2229 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2230 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2231 call sort(g:netrw_bookmarklist)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2232 exe "sil! w! ".savefile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2233 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2234
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2235 " construct and save .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2236 call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2237 exe "sil! w! ".savefile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2238 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2239 let bgone= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2240 q!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2241 exe bgone."bwipe!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2242
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2243 " call Dret("s:NetrwBookHistSave")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2244 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2245
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2246 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2247 " 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
2248 " 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
2249 " 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
2250 " with the requested remote hostname first.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2251 fun! s:NetrwBrowse(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2252 if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2253 " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2254 " call Decho("tab#".tabpagenr()." win#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2255 " call Dredir("ls!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2256 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2257 call s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2258 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2259
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2260 " simplify the dirname (especially for ".."s in dirnames)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2261 if a:dirname !~ '^\a\+://'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2262 let dirname= simplify(a:dirname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2263 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2264 let dirname= a:dirname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2265 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2266
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2267 if exists("s:netrw_skipbrowse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2268 unlet s:netrw_skipbrowse
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2269 " 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
2270 " call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2271 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2272 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2273 if !exists("*shellescape")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2274 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
2275 " call Dret("s:NetrwBrowse : missing shellescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2276 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2277 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2278 if !exists("*fnameescape")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2279 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
2280 " call Dret("s:NetrwBrowse : missing fnameescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2281 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2282 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2283
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2284 call s:NetrwOptionSave("w:")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2285
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2286 " re-instate any marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2287 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2288 " call Decho("clearing marked files")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2289 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
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 if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2293 " call Decho("handle w:netrw_acdkeep:")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2294 " call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2295 exe 'keepj lcd '.fnameescape(dirname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2296 call s:NetrwSafeOptions()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2297 " call Decho("getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2298
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2299 elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2300 " looks like a regular file, attempt transfer
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2301 " call Decho("attempt transfer as regular file<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2302
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2303 " remove any filetype indicator from end of dirname, except for the {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2304 " "this is a directory" indicator (/).
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2305 " There shouldn't be one of those here, anyway.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2306 let path= substitute(dirname,'[*=@|]\r\=$','','e')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2307 " call Decho("new path<".path.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2308 call s:RemotePathAnalysis(dirname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2309
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2310 " remote-read the requested file into current buffer {{{3
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2311 keepj mark '
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2312 call s:NetrwEnew(dirname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2313 call s:NetrwSafeOptions()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2314 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2315 " call Decho("setlocal ma noro")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2316 let b:netrw_curdir= dirname
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2317 " call Decho("exe sil! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)." (bt=".&bt.")")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2318 exe "sil! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2319 exe "sil! keepalt doau BufReadPre ".fnameescape(s:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2320 silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2321 if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz' && s:path !~ '.tar.xz' && s:path !~ '.txz'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2322 " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2323 exe "sil keepalt doau BufReadPost ".fnameescape(s:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2324 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2325
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2326 " save certain window-oriented variables into buffer-oriented variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2327 call s:SetBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2328 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2329 setlocal ma nomod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2330
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2331 " 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
2332 " call Dret("s:NetrwBrowse : file<".s:fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2333 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2334 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2335
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2336 " 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
2337 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2338
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2339 " set up some variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2340 let b:netrw_browser_active = 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2341 let dirname = dirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2342 let s:last_sort_by = g:netrw_sort_by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2343
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2344 " set up menu {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2345 call s:NetrwMenu(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2347 " set up buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2348 let reusing= s:NetrwGetBuffer(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2349 " maintain markfile highlighting
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2350 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2351 " call Decho("bufnr(%)=".bufnr('%'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2352 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2353 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2354 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2355 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2356 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2357 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2358 if reusing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2359 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2360 setlocal noma nomod nowrap
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2361 " 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
2362 " call Dret("s:NetrwBrowse : re-using buffer")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2363 return
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2366 " set b:netrw_curdir to the new directory name {{{3
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2367 " call Decho("set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2368 let b:netrw_curdir= dirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2369 if b:netrw_curdir =~ '[/\\]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2370 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2371 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2372 if b:netrw_curdir == ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2373 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2374 " On the Amiga, the empty string connotes the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2375 let b:netrw_curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2376 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2377 " under unix, when the root directory is encountered, the result
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2378 " from the preceding substitute is an empty string.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2379 let b:netrw_curdir= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2380 endif
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 if !a:islocal && b:netrw_curdir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2383 let b:netrw_curdir= b:netrw_curdir.'/'
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 Decho("b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2386
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2387 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2388 " (local only) {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2389 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2390 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2391 " call Decho("local only:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2392
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2393 " Set up ShellCmdPost handling. Append current buffer to browselist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2394 call s:LocalFastBrowser()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2395
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2396 " 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
2397 if !g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2398 " call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2399 " call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2400 if !exists("&l:acd") || !&l:acd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2401 " call Decho('exe keepjumps lcd '.fnameescape(b:netrw_curdir))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2402 try
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2403 exe 'keepj lcd '.fnameescape(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2404 catch /^Vim\%((\a\+)\)\=:E472/
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2405 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
2406 if exists("w:netrw_prvdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2407 let b:netrw_curdir= w:netrw_prvdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2408 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2409 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2410 setlocal noma nomod nowrap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2411 let b:netrw_curdir= dirname
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2412 " 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
2413 " 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
2414 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2415 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2416 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2417 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2418 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2419
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2420 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2421 " remote handling: {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2422 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2423 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2424 " call Decho("remote only:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2425
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2426 " analyze dirname and g:netrw_list_cmd {{{4
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2427 " 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
2428 if dirname =~ "^NetrwTreeListing\>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2429 let dirname= b:netrw_curdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2430 " call Decho("(dirname was ".dirname.") dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2431 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
2432 let dirname= substitute(b:netrw_curdir,'\\','/','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2433 if dirname !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2434 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2435 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2436 let b:netrw_curdir = dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2437 " call Decho("(liststyle is TREELIST) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2438 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2439 let dirname = substitute(dirname,'\\','/','g')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2440 " call Decho("(normal) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2441 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2442
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2443 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2444 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2445 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2446 call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2447 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2448 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2449 setlocal noma nomod nowrap
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2450 " 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
2451 " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2452 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2453 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2454 let b:netrw_curdir= dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2455 " call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2456 endif " (additional remote handling)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2457
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2458 " -----------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2459 " Directory Listing: {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2460 " -----------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2461 call s:BrowserMaps(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2462 call s:PerformListing(a:islocal)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2463
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2464 " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2465 " 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
2466 " 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
2467 " 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
2468 " 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
2469 " 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
2470 let s:locbrowseshellcmd= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2471
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2472 " 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
2473 " call Dret("s:NetrwBrowse : did PerformListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2474 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2475 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2476
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2477 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2478 " s:NetrwFileInfo: supports qf (query for file information) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2479 fun! s:NetrwFileInfo(islocal,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2480 " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2481 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2482 if (has("unix") || has("macunix")) && executable("/bin/ls")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2483 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2484 " call Decho('using ls with b:netrw_curdir<'.b:netrw_curdir.'>')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2485 if b:netrw_curdir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2486 echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2487 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2488 echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2489 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2490 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2491 " call Decho('using ls '.a:fname." using cwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2492 echo system("/bin/ls -lsad ".shellescape(a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2493 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2494 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2495 " use vim functions to return information about file below cursor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2496 " call Decho("using vim functions to query for file info")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2497 if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2498 let fname= substitute(a:fname,".$","","")
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 fname= a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2501 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2502 let t = getftime(fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2503 let sz = getfsize(fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2504 echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2505 " call Decho(fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)))
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 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2508 echo "sorry, \"qf\" not supported yet for remote files"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2509 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2510 " call Dret("s:NetrwFileInfo")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2511 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2512
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2513 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2514 " s:NetrwGetBuffer: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2515 " returns 0=cleared buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2516 " 1=re-used buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2517 fun! s:NetrwGetBuffer(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2518 " 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
2519 let dirname= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2520
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2521 " re-use buffer if possible {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2522 " call Decho("--re-use a buffer if possible--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2523 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2524 " find NetrwTreeList buffer if there is one
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2525 " call Decho("find NetrwTreeList buffer if there is one")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2526 if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2527 " call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2528 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2529 set ei=all
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2530 exe "sil! b ".w:netrw_treebufnr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2531 let &ei= eikeep
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2532 " call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2533 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2534 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2535 let bufnum= -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2536 " call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2537
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2538 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2539 " find buffer number of buffer named precisely the same as dirname {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2540 " call Decho("--find buffer numnber of buffer named precisely the same as dirname--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2541 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2542
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2543 " get dirname and associated buffer number
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2544 let bufnum = bufnr(escape(dirname,'\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2545 " call Decho(" find buffer<".dirname.">'s number ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2546 " call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2547
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2548 if bufnum < 0 && dirname !~ '/$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2549 " try appending a trailing /
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2550 " call Decho(" try appending a trailing / to dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2551 let bufnum= bufnr(escape(dirname.'/','\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2552 if bufnum > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2553 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2554 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2555 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2556
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2557 if bufnum < 0 && dirname =~ '/$'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2558 " try removing a trailing /
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2559 " call Decho(" try removing a trailing / from dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2560 let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2561 if bufnum > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2562 let dirname= substitute(dirname,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2563 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2564 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2565
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2566 " call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2567 " 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
2568 if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2569 " handle approximate matches
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2570 " call Decho(" handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2571 let ibuf = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2572 let buflast = bufnr("$")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2573 " call Decho(" findbuf2: buflast=bufnr($)=".buflast)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2574 while ibuf <= buflast
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2575 let bname= substitute(bufname(ibuf),'\\','/','g')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2576 let bname= substitute(bname,'.\zs/$','','')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2577 " call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2578 if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2579 " bname is not empty
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2580 " dirname ends with bname,
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2581 " dirname doesn't start with /, so its not a absolute path
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2582 " call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2583 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2584 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2585 if bname =~ '^'.dirname.'/\=$'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2586 " bname begins with dirname
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2587 " call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2588 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2589 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2590 if dirname =~ '^'.bname.'/$'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2591 " call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2592 break
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2593 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2594 if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2595 " call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2596 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2597 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2598 let ibuf= ibuf + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2599 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2600 if ibuf > buflast
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2601 let bufnum= -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2602 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2603 let bufnum= ibuf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2604 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2605 " call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2606 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2607 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2608
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2609 " get enew buffer and name it -or- re-use buffer {{{3
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2610 sil! keepj mark '
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2611 if bufnum < 0 || !bufexists(bufnum)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2612 " call Decho("--get enew buffer and name it (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2613 call s:NetrwEnew(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2614 " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2615 " name the buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2616 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2617 " Got enew buffer; transform into a NetrwTreeListing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2618 " call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2619 if !exists("s:netrw_treelistnum")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2620 let s:netrw_treelistnum= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2621 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2622 let s:netrw_treelistnum= s:netrw_treelistnum + 1
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 let w:netrw_treebufnr= bufnr("%")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2625 " call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2626 exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2627 set bt=nofile noswf
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2628 nnoremap <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2629 nnoremap <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2630 nnoremap <silent> <buffer> [[ :silent call <SID>TreeListMove('[')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2631 nnoremap <silent> <buffer> ]] :silent call <SID>TreeListMove(']')<cr>
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2632 " call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2633 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2634 " let v:errmsg= "" " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2635 let escdirname= fnameescape(dirname)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2636 " call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2637 " call Decho(' exe sil! keepalt file '.escdirname)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2638 " let v:errmsg= "" " Decho
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2639 exe 'sil! keepalt file '.escdirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2640 " call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2641 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2642 " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2643
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2644 else " Re-use the buffer
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2645 " call Decho("--re-use buffer#".bufnum." (bufexists([bufnum=".bufnum."])=".bufexists(bufnum).")")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2646 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2647 set ei=all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2648 if getline(2) =~ '^" Netrw Directory Listing'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2649 " call Decho(" re-use buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: keepalt b ".bufnum)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2650 exe "sil! keepalt b ".bufnum
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2651 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2652 " call Decho(" reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2653 exe "sil! b ".bufnum
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2654 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2655 if bufname("%") == '.'
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2656 " call Decho("exe sil! keepalt file ".fnameescape(getcwd()))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2657 exe "sil! keepalt file ".fnameescape(getcwd())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2658 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2659 let &ei= eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2660 if line("$") <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2661 call s:NetrwListSettings(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2662 " 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
2663 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2664 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2665 " call Decho("--re-use tree listing--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2666 " call Decho(" clear buffer<".expand("%")."> with :%d")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2667 sil keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2668 call s:NetrwListSettings(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2669 " 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
2670 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2671 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2672 " call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2673 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2674 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2675 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2676
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2677 " 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
2678 " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2679 " 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
2680 " med 1 D H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2681 " fast 2 H H
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2682 " call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2683 let fname= expand("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2684 call s:NetrwListSettings(a:islocal)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2685 " call Decho("exe sil! keepalt file ".fnameescape(fname))
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2686 exe "sil! keepalt file ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2687
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2688 " delete all lines from buffer {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2689 " call Decho("--delete all lines from buffer--")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2690 " call Decho(" clear buffer<".expand("%")."> with :%d")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2691 sil! keepalt keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2692
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2693 " call Dret("s:NetrwGetBuffer 0 : buf#".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2694 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2695 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2696
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2697 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2698 " s:NetrwGetcwd: get the current directory. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2699 " Change backslashes to forward slashes, if any.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2700 " If doesc is true, escape certain troublesome characters
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2701 fun! s:NetrwGetcwd(doesc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2702 " call Dfunc("NetrwGetcwd(doesc=".a:doesc.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2703 let curdir= substitute(getcwd(),'\\','/','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2704 if curdir !~ '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2705 let curdir= curdir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2706 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2707 if a:doesc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2708 let curdir= fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2709 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2710 " call Dret("NetrwGetcwd <".curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2711 return curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2712 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2713
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2714 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2715 " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2716 fun! s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2717 " call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2718 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2719
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2720 " insure that w:netrw_liststyle is set up
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2721 if !exists("w:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2722 if exists("g:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2723 let w:netrw_liststyle= g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2724 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2725 let w:netrw_liststyle= s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2726 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2727 " call Decho("w:netrw_liststyle=".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2728 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2729
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2730 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2731 " Active Banner support
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2732 " call Decho("active banner handling")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2733 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2734 let dirname= "./"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2735 let curline= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2736
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2737 if curline =~ '"\s*Sorted by\s'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2738 keepj norm s
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2739 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2740 echo 'Pressing "s" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2741
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2742 elseif curline =~ '"\s*Sort sequence:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2743 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2744 echo 'Press "S" to edit sorting sequence'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2745
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2746 elseif curline =~ '"\s*Quick Help:'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2747 keepj norm ?
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2748 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2749 echo 'Pressing "?" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2750
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2751 elseif curline =~ '"\s*\%(Hiding\|Showing\):'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2752 keepj norm a
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2753 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2754 echo 'Pressing "a" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2755
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2756 elseif line("$") > w:netrw_bannercnt
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2757 exe 'sil keepj '.w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2758 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2759
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2760 elseif w:netrw_liststyle == s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2761 " call Decho("thin column handling")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2762 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2763 let dirname= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2764
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2765 elseif w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2766 " call Decho("long column handling")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2767 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2768 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2769
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2770 elseif w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2771 " call Decho("treelist handling")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2772 let dirname= substitute(getline('.'),'^\(| \)*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2773
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2774 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2775 " call Decho("obtain word from wide listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2776 let dirname= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2777
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2778 if !exists("b:netrw_cpf")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2779 let b:netrw_cpf= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2780 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
2781 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2782 " call Decho("computed cpf=".b:netrw_cpf)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2783 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2784
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2785 " call Decho("buf#".bufnr("%")."<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2786 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2787 " 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
2788 " call Decho("1: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2789 if filestart == 0
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2790 keepj norm! 0ma
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2791 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2792 call cursor(line("."),filestart+1)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2793 keepj norm! ma
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2794 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2795 let rega= @a
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2796 let eofname= filestart + b:netrw_cpf + 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2797 if eofname <= col("$")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2798 call cursor(line("."),filestart+b:netrw_cpf+1)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2799 keepj norm! "ay`a
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2800 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2801 keepj norm! "ay$
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2802 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2803 let dirname = @a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2804 let @a = rega
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2805 " call Decho("2: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2806 let dirname= substitute(dirname,'\s\+$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2807 " call Decho("3: dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2808 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2809
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2810 " symlinks are indicated by a trailing "@". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2811 let dirname= substitute(dirname,"@$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2812
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2813 " executables are indicated by a trailing "*". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2814 let dirname= substitute(dirname,"\*$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2815
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2816 " call Dret("s:NetrwGetWord <".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2817 return dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2818 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2819
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2820 " ---------------------------------------------------------------------
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2821 " s:NetrwListSettings: make standard settings for a netrw listing {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2822 fun! s:NetrwListSettings(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2823 " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2824 let fname= bufname("%")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2825 " call Decho("setlocal bt=nofile nobl ma nonu nowrap noro")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2826 setlocal bt=nofile nobl ma nonu nowrap noro
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2827 " call Decho("exe sil! keepalt file ".fnameescape(fname))
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2828 exe "sil! keepalt file ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2829 if g:netrw_use_noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2830 setlocal noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2831 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2832 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2833 " call Decho("exe setlocal ts=".g:netrw_maxfilenamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2834 exe "setlocal ts=".g:netrw_maxfilenamelen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2835 setlocal isk+=.,~,-
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2836 if g:netrw_fastbrowse > a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2837 setlocal bh=hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2838 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2839 setlocal bh=delete
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2840 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2841 " call Dret("s:NetrwListSettings")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2842 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2843
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2844 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2845 " s:NetrwListStyle: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2846 " islocal=0: remote browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2847 " =1: local browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2848 fun! s:NetrwListStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2849 " call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2850 let fname = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2851 if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2852 let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2853 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2854 " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2855 " 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
2856
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2857 if w:netrw_liststyle == s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2858 " use one column listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2859 " call Decho("use one column list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2860 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2861
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2862 elseif w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2863 " use long list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2864 " call Decho("use long list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2865 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2866
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2867 elseif w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2868 " give wide list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2869 " call Decho("use wide list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2870 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2871
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2872 elseif w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2873 " call Decho("use tree list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2874 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2875
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2876 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2877 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
2878 let g:netrw_liststyle = s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2879 let w:netrw_liststyle = g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2880 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2881 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2882 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2883 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2884
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2885 " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2886 " call Decho("clear buffer<".expand("%")."> with :%d")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2887 sil! keepj %d
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2888 " following prevents tree listing buffer from being marked "modified"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2889 setlocal nomod
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2890
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2891 " refresh the listing
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2892 " call Decho("refresh the listing")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2893 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2894 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2895 call netrw#NetrwRestorePosn(svpos)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2896 call s:NetrwCursorline()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2897
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2898 " keep cursor on the filename
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2899 sil! keepj $
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2900 let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2901 " 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
2902 if result <= 0 && exists("w:netrw_bannercnt")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2903 exe "sil! keepj ".w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2904 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2905
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2906 " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : ""))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2907 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2908
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2909 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2910 " s:NetrwBannerCtrl: toggles the display of the banner {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2911 fun! s:NetrwBannerCtrl(islocal)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2912 " 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
2913
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2914 " toggle the banner (enable/suppress)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2915 let g:netrw_banner= !g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2916
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2917 " refresh the listing
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2918 let svpos= netrw#NetrwSavePosn()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2919 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2920
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2921 " keep cursor on the filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2922 let fname= s:NetrwGetWord()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2923 sil keepj $
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2924 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
2925 " 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
2926 if result <= 0 && exists("w:netrw_bannercnt")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2927 exe "keepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2928 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2929 " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2930 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2931
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2932 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2933 " s:NetrwBookmarkMenu: Uses menu priorities {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2934 " .2.[cnt] for bookmarks, and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2935 " .3.[cnt] for history
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2936 " (see s:NetrwMenu())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2937 fun! s:NetrwBookmarkMenu()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2938 if !exists("s:netrw_menucnt")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2939 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2940 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2941 " call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2942
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2943 " 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
2944 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
2945 if exists("g:NetrwTopLvlMenu")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2946 " call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2947 exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2948 exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2949 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2950 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2951 call s:NetrwBookHistRead()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2952 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2953
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2954 " show bookmarked places
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2955 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2956 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2957 for bmd in g:netrw_bookmarklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2958 " call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2959 let bmd= escape(bmd,g:netrw_menu_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2960
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2961 " show bookmarks for goto menu
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2962 exe 'sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\<cr>"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2963
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2964 " show bookmarks for deletion menu
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2965 exe 'sil! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2966 let cnt= cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2967 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2968
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2969 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2970
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2971 " show directory browsing history
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2972 let cnt = g:netrw_dirhist_cnt
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2973 let first = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2974 let histcnt = 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2975 while ( first || cnt != g:netrw_dirhist_cnt )
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2976 let histcnt = histcnt + 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2977 let priority = g:netrw_dirhist_cnt + histcnt
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2978 if exists("g:netrw_dirhist_{cnt}")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2979 let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2980 " call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
2981 exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\<cr>"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2982 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2983 let first = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2984 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2985 if cnt < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2986 let cnt= cnt + g:netrw_dirhistmax
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2987 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2988 endwhile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2989
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2990 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2991 " call Dret("NetrwBookmarkMenu")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2992 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2993
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2994 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2995 " s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2996 " directory and a new directory name. Also, if the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2997 " "new directory name" is actually a file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2998 " NetrwBrowseChgDir() edits the file.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2999 fun! s:NetrwBrowseChgDir(islocal,newdir,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3000 " 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
3001
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3002 if !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3003 " 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
3004 " and the current window is the NetrwMessage window.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3005 " call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3006 " call Decho("getcwd<".getcwd().">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3007 " call Dredir("ls!")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3008 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3009 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3010 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3011
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3012 call s:NetrwOptionSave("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3013 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3014 let nbcd_curpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3015 let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3016 if (has("win32") || has("win95") || has("win64") || has("win16"))
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3017 let dirname = substitute(b:netrw_curdir,'\\','/','ge')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3018 else
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3019 let dirname= b:netrw_curdir
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3020 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3021 let newdir = a:newdir
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3022 let dolockout = 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3023
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3024 " set up o/s-dependent directory recognition pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3025 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3026 let dirpat= '[\/:]$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3027 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3028 let dirpat= '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3029 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3030 " call Decho("dirname<".dirname."> dirpat<".dirpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3031
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3032 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3033 " apparently vim is "recognizing" that it is in a directory and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3034 " is removing the trailing "/". Bad idea, so I put it back.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3035 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3036 " call Decho("adjusting dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3037 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3038
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3039 if newdir !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3040 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3041 " edit a file:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3042 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3043 " call Decho('case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3044 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
3045 let dirname= s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3046 if dirname =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3047 let dirname= dirname.newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3048 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3049 let dirname= s:NetrwTreeDir()."/".newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3050 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3051 " call Decho("dirname<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3052 " call Decho("tree listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3053 elseif newdir =~ '^\(/\|\a:\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3054 let dirname= newdir
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3055 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3056 let dirname= s:ComposePath(dirname,newdir)
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 Decho("handling a file: dirname<".dirname."> (a:0=".a:0.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3059 " this lets NetrwBrowseX avoid the edit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3060 if a:0 < 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3061 " 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
3062 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3063 if !exists("s:didsplit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3064 if g:netrw_browse_split == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3065 new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3066 if !&ea
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3067 wincmd _
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3068 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3069 elseif g:netrw_browse_split == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3070 rightb vert new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3071 if !&ea
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3072 wincmd |
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3073 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3074 elseif g:netrw_browse_split == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3075 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3076 elseif g:netrw_browse_split == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3077 if s:NetrwPrevWinOpen(2) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3078 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3079 return
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 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3082 " handling a file, didn't split, so remove menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3083 " call Decho("handling a file+didn't split, so remove menu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3084 call s:NetrwMenu(0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3085 " optional change to window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3086 if g:netrw_chgwin >= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3087 exe "keepjumps ".g:netrw_chgwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3088 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3089 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3090 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3091
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3092 " the point where netrw actually edits the (local) file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3093 " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3094 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3095 " call Decho("edit local file: exe e! ".fnameescape(dirname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3096 exe "e! ".fnameescape(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3097 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3098 " call Decho("remote file: NetrwBrowse will edit it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3099 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3100 let dolockout= 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3101
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3102 " handle g:Netrw_funcref -- call external-to-netrw functions
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3103 " 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
3104 " 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
3105 " a function reference. See :help Funcref for information about function references.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3106 if exists("g:Netrw_funcref")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3107 " call Decho("handle optional Funcrefs")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3108 if type(g:Netrw_funcref) == 2
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3109 " call Decho("handling a g:Netrw_funcref")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3110 call g:Netrw_funcref()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3111 elseif type(g:Netrw_funcref) == 3
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3112 " call Decho("handling a list of g:Netrw_funcrefs")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3113 for Fncref in g:Netrw_funcref
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3114 if type(FncRef) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3115 call FncRef()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3116 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3117 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3118 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3119 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3120 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3121
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3122 elseif newdir =~ '^/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3123 " ---------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3124 " just go to the new directory spec
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 Decho('case "just go to new directory spec": newdir<'.newdir.'>')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3127 let dirname= newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3128 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3129 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3130
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3131 elseif newdir == './'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3132 " --------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3133 " refresh the directory list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3134 " --------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3135 " call Decho('case "refresh directory listing": newdir == "./"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3136 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3137
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3138 elseif newdir == '../'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3139 " -------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3140 " go up one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3141 " -------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3142 " call Decho('case "go up one directory": newdir == "../"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3143
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3144 if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3145 " force a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3146 " call Decho("clear buffer<".expand("%")."> with :%d")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3147 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3148 " call Decho("setlocal noro ma")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3149 keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3150 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3151
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3152 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3153 " amiga
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3154 " call Decho('case "go up one directory": newdir == "../" and amiga')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3155 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3156 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3157 let dirname= substitute(dirname,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3158 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3159 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3160 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3161 " call Decho("amiga: dirname<".dirname."> (go up one dir)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3162
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3163 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3164 " unix or cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3165 " call Decho('case "go up one directory": newdir == "../" and unix or cygwin')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3166 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3167 let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3168 if dirname == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3169 let dirname= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3170 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3171 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3172 let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3173 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3174 " call Decho("unix: dirname<".dirname."> (go up one dir)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3175 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3176 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3177
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3178 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
3179 " call Decho('case liststyle is TREELIST and w:netrw_treedict exists')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3180 " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3181 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3182 " call Decho("setlocal noro ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3183 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
3184 " call Decho("clear buffer<".expand("%")."> with :%d")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3185 keepj %d
1621
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 let treedir = s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3188 let s:treecurpos = nbcd_curpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3189 let haskey= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3190 " call Decho("w:netrw_treedict<".string(w:netrw_treedict).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3191
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3192 " search treedict for tree dir as-is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3193 if has_key(w:netrw_treedict,treedir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3194 " call Decho('....searched for treedir<'.treedir.'> : found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3195 let haskey= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3196 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3197 " call Decho('....searched for treedir<'.treedir.'> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3198 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3199
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3200 " search treedict for treedir with a / appended
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3201 if !haskey && treedir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3202 if has_key(w:netrw_treedict,treedir."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3203 let treedir= treedir."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3204 " call Decho('....searched.for treedir<'.treedir.'> found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3205 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3206 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3207 " call Decho('....searched for treedir<'.treedir.'/> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3208 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3209 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3210
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3211 " search treedict for treedir with any trailing / elided
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3212 if !haskey && treedir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3213 let treedir= substitute(treedir,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3214 if has_key(w:netrw_treedict,treedir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3215 " call Decho('....searched.for treedir<'.treedir.'> found it!')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3216 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3217 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3218 " call Decho('....searched for treedir<'.treedir.'> : not found')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3219 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3220 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3221
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3222 if haskey
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3223 " close tree listing for selected subdirectory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3224 " call Decho("closing selected subdirectory<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3225 call remove(w:netrw_treedict,treedir)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3226 " call Decho("removed entry<".treedir."> from treedict")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3227 " call Decho("yielding treedict<".string(w:netrw_treedict).">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3228 let dirname= w:netrw_treetop
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3229 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3230 " go down one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3231 let dirname= substitute(treedir,'/*$','/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3232 " call Decho("go down one dir: treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3233 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3234 call s:SetRexDir(a:islocal,dirname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3235 let s:treeforceredraw = 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3236
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3237 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3238 " go down one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3239 let dirname= s:ComposePath(dirname,newdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3240 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3241 call s:SetRexDir(a:islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3242 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3243
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3244 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3245 if dolockout
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3246 " call Decho("filewritable(dirname<".dirname.">)=".filewritable(dirname))
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3247 if filewritable(dirname)
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3248 " call Decho("doing modification lockout settings: ma nomod noro")
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3249 setlocal ma nomod noro
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3250 else
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3251 " call Decho("doing modification lockout settings: ma nomod ro")
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3252 setlocal ma nomod ro
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3253 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3254 " call Decho("setlocal ma nomod noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3255 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3256
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3257 " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3258 return dirname
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3259 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3260
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3261 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3262 " 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
3263 " given filename; typically this means given their extension.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3264 " 0=local, 1=remote
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3265 fun! netrw#NetrwBrowseX(fname,remote)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3266 " call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3267
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3268 " special core dump handler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3269 if a:fname =~ '/core\(\.\d\+\)\=$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3270 if exists("g:Netrw_corehandler")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3271 if type(g:Netrw_corehandler) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3272 " g:Netrw_corehandler is a function reference (see :help Funcref)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3273 " call Decho("g:Netrw_corehandler is a funcref")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3274 call g:Netrw_corehandler(a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3275 elseif type(g:netrw_corehandler) == 3)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3276 " 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
3277 " call Decho("g:Netrw_corehandler is a List")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3278 for Fncref in g:Netrw_corehandler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3279 if type(FncRef) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3280 call FncRef(a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3281 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3282 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3283 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3284 " call Dret("NetrwBrowseX : coredump handler invoked")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3285 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3286 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3287 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3288
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3289 " set up the filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3290 " (lower case the extension, make a local copy of a remote file)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3291 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3292 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3293 let exten= substitute(exten,'^.*$','\L&\E','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3294 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3295 " call Decho("exten<".exten.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3296
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3297 " seems kde systems often have gnome-open due to dependencies, even though
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3298 " gnome-open's subsidiary display tools are largely absent. Kde systems
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3299 " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3300 if !exists("s:haskdeinit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3301 if has("unix")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3302 let s:haskdeinit= system("ps -e") =~ 'kdeinit'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3303 if v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3304 let s:haskdeinit = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3305 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3306 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3307 let s:haskdeinit= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3308 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3309 " call Decho("setting s:haskdeinit=".s:haskdeinit)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3310 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3311
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3312 if a:remote == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3313 " create a local copy
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3314 " 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
3315 setlocal bh=delete
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3316 call netrw#NetRead(3,a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3317 " attempt to rename tempfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3318 let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3319 let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3320 " call Decho("basename<".basename.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3321 " call Decho("newname <".newname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3322 if rename(s:netrw_tmpfile,newname) == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3323 " renaming succeeded
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3324 let fname= newname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3325 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3326 " renaming failed
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3327 let fname= s:netrw_tmpfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3328 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3329 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3330 let fname= a:fname
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3331 " special ~ handler for local
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3332 if fname =~ '^\~' && expand("$HOME") != ""
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3333 " call Decho('invoking special ~ handler')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3334 let fname= substitute(fname,'^\~',expand("$HOME"),'')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3335 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3336 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3337 " call Decho("fname<".fname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3338 " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3339
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3340 " set up redirection
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3341 if &srr =~ "%s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3342 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3343 let redir= substitute(&srr,"%s","nul","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3344 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3345 let redir= substitute(&srr,"%s","/dev/null","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3346 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3347 elseif (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3348 let redir= &srr . "nul"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3349 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3350 let redir= &srr . "/dev/null"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3351 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3352 " call Decho("redir{".redir."} srr{".&srr."}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3353
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3354 " extract any viewing options. Assumes that they're set apart by quotes.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3355 if exists("g:netrw_browsex_viewer")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3356 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3357 if g:netrw_browsex_viewer =~ '\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3358 let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3359 let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3360 let oviewer = ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3361 let cnt = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3362 while !executable(viewer) && viewer != oviewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3363 let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3364 let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3365 let cnt = cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3366 let oviewer = viewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3367 " call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3368 endwhile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3369 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3370 let viewer = g:netrw_browsex_viewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3371 let viewopt = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3372 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3373 " call Decho("viewer<".viewer."> viewopt<".viewopt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3374 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3375
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3376 " execute the file handler
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3377 if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3378 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3379 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3380
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3381 elseif exists("g:netrw_browsex_viewer") && executable(viewer)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3382 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3383 " call Decho("exe silent !".viewer." ".viewopt.shellescape(fname,1).redir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3384 exe "silent !".viewer." ".viewopt.shellescape(fname,1).redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3385 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3386
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3387 elseif has("win32") || has("win64")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3388 if executable("start")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3389 " 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
3390 exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3391 elseif executable("rundll32")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3392 " call Decho('exe silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3393 exe 'silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3394 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3395 call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3396 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3397 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3398 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3399
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3400 elseif has("unix") && executable("gnome-open") && !s:haskdeinit
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3401 " call Decho("exe silent !gnome-open ".shellescape(fname,1)." ".redir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3402 exe "sil !gnome-open ".shellescape(fname,1).redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3403 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3404
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3405 elseif has("unix") && executable("kfmclient") && s:haskdeinit
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3406 " call Decho("exe silent !kfmclient exec ".shellescape(fname,1)." ".redir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3407 exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3408 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3409
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3410 elseif has("macunix") && executable("open")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3411 " call Decho("exe silent !open ".shellescape(fname,1)." ".redir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3412 exe "sil !open ".shellescape(fname,1)." ".redir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3413 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3414
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3415 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3416 " netrwFileHandlers#Invoke() always returns 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3417 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3418 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3419
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3420 " if unsuccessful, attempt netrwFileHandlers#Invoke()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3421 if ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3422 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3423 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3424
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3425 " restoring redraw! after external file handlers
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3426 redraw!
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3427
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3428 " cleanup: remove temporary file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3429 " delete current buffer if success with handler,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3430 " return to prior buffer (directory listing)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3431 " Feb 12, 2008: had to de-activiate removal of
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3432 " temporary file because it wasn't getting seen.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3433 " if a:remote == 1 && fname != a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3434 " call Decho("deleting temporary file<".fname.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
3435 " call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3436 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3437
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3438 if a:remote == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3439 setlocal bh=delete bt=nofile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3440 if g:netrw_use_noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3441 setlocal noswf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3442 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3443 exe "keepj norm! \<c-o>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3444 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3445 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3446
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3447 " call Dret("NetrwBrowseX")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3448 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3449
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3450 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3451 " s:NetrwChgPerm: (implements "gp") change file permission {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3452 fun! s:NetrwChgPerm(islocal,curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3453 " call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3454 call inputsave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3455 let newperm= input("Enter new permission: ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3456 call inputrestore()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3457 let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',shellescape(expand("<cfile>")),'')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3458 let chgperm= substitute(chgperm,'\<PERM\>',shellescape(newperm),'')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3459 " call Decho("chgperm<".chgperm.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3460 call system(chgperm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3461 if v:shell_error != 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3462 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
3463 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3464 if a:islocal
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3465 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3466 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3467 " call Dret("s:NetrwChgPerm")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3468 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3469
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3470 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3471 " s:NetrwClearExplore: clear explore variables (if any) {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3472 fun! s:NetrwClearExplore()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3473 " call Dfunc("s:NetrwClearExplore()")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3474 2match none
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3475 if exists("s:explore_match") |unlet s:explore_match |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3476 if exists("s:explore_indx") |unlet s:explore_indx |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3477 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
3478 if exists("s:dirstarstar") |unlet s:dirstarstar |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3479 if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3480 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
3481 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
3482 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
3483 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
3484 " redraw!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3485 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3486 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3487 " call Dret("s:NetrwClearExplore")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3488 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3489
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3490 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3491 " 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
3492 " indx: == -1: Nexplore
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3493 " == -2: Pexplore
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3494 " == +: this is overloaded:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3495 " * If Nexplore/Pexplore is in use, then this refers to the
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3496 " 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
3497 " matched the */pattern **/pattern *//pattern **//pattern
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3498 " * If Hexplore or Vexplore, then this will override
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3499 " 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
3500 " newly split window should have.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3501 " 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
3502 " 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
3503 " style == 0: Explore style == 1: Explore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3504 " == 2: Hexplore style == 3: Hexplore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3505 " == 4: Vexplore style == 5: Vexplore!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3506 " == 6: Texplore
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3507 fun! netrw#Explore(indx,dosplit,style,...)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3508 " 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
3509 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3510 let b:netrw_curdir= getcwd()
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3511 " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3512 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3513 let curdir = simplify(b:netrw_curdir)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3514 let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3515 " call Decho("curdir<".curdir."> curfiledir<".curfiledir.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3516
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3517 " save registers
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3518 sil! let keepregstar = @*
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3519 sil! let keepregplus = @+
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3520 sil! let keepregslash= @/
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3521
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3522 " if dosplit or file has been modified
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3523 if a:dosplit || &modified || a:style == 6
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3524 " call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3525 call s:SaveWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3526 let winsize= g:netrw_winsize
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3527 if a:indx > 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3528 let winsize= a:indx
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3529 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3530
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3531 if a:style == 0 " Explore, Sexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3532 " call Decho("style=0: Explore or Sexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3533 exe winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3534
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3535 elseif a:style == 1 "Explore!, Sexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3536 " call Decho("style=1: Explore! or Sexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3537 exe winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3538
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3539 elseif a:style == 2 " Hexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3540 " call Decho("style=2: Hexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3541 exe "bel ".winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3542
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3543 elseif a:style == 3 " Hexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3544 " call Decho("style=3: Hexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3545 exe "abo ".winsize."wincmd s"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3546
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3547 elseif a:style == 4 " Vexplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3548 " call Decho("style=4: Vexplore")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3549 exe "lefta ".winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3550
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3551 elseif a:style == 5 " Vexplore!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3552 " call Decho("style=5: Vexplore!")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3553 exe "rightb ".winsize."wincmd v"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3554
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3555 elseif a:style == 6 " Texplore
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3556 call s:SaveBufVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3557 " call Decho("style = 6: Texplore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3558 tabnew
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3559 call s:RestoreBufVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3560 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3561 call s:RestoreWinVars()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3562 " else " Decho
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3563 " call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3564 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3565 keepj norm! 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3566
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3567 if a:0 > 0
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3568 " call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3569 if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3570 " call Decho("case a:1: ~ and unix or cygwin")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3571 let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),''))
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3572 " call Decho("using dirname<".dirname."> (case: ~ && unix||cygwin)")
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3573 elseif a:1 == '.'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3574 " call Decho("case a:1: .")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3575 let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd())
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3576 if dirname !~ '/$'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3577 let dirname= dirname."/"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3578 endif
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3579 " 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
3580 elseif a:1 =~ '\$'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3581 " call Decho("case a:1: $")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3582 let dirname= simplify(expand(a:1))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3583 " call Decho("using user-specified dirname<".dirname."> with $env-var")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3584 elseif a:1 !~ '^\*/'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3585 " call Decho("case a:1: other, not pattern or filepattern")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3586 let dirname= simplify(a:1)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3587 " call Decho("using user-specified dirname<".dirname.">")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3588 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3589 " call Decho("case a:1: pattern or filepattern")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
3590 let dirname= a:1
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3591 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3592 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3593 " clear explore
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3594 " call Decho("case a:0=".a:0.": clearing Explore list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3595 call s:NetrwClearExplore()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3596 " call Dret("netrw#Explore : cleared list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3597 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3598 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3599
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3600 " call Decho("dirname<".dirname.">")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3601 if dirname =~ '\.\./\=$'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3602 let dirname= simplify(fnamemodify(dirname,':p:h'))
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3603 elseif dirname =~ '\.\.' || dirname == '.'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3604 let dirname= simplify(fnamemodify(dirname,':p'))
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3605 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3606 " call Decho("dirname<".dirname."> (after simplify)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3607
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3608 if dirname =~ '/\*\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3609 " handle .../**/.../filepat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3610 " call Decho("case Explore .../**/.../filepat")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3611 let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3612 if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16")))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3613 let b:netrw_curdir = prefixdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3614 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3615 let b:netrw_curdir= getcwd().'/'.prefixdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3616 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3617 let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3618 let starpat= 4;
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3619 " call Decho("pwd<".getcwd()."> dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3620 " call Decho("case Explore ../**/../filepat (starpat=".starpat.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3622 elseif dirname =~ '^\*//'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3623 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3624 " call Decho("case Explore *//pattern")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3625 let pattern= substitute(dirname,'^\*//\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3626 let starpat= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3627 " call Decho("Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3628 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3629
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3630 elseif dirname =~ '^\*\*//'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3631 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3632 " call Decho("case Explore **//pattern")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3633 let pattern= substitute(dirname,'^\*\*//','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3634 let starpat= 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3635 " call Decho("Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3636
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3637 elseif dirname =~ '^\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3638 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3639 let starpat= 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3640 " call Decho("case Explore */filepat (starpat=".starpat.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3641
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3642 elseif dirname=~ '^\*\*/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3643 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3644 let starpat= 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3645 " call Decho("case Explore **/filepat (starpat=".starpat.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3646
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3647 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3648 let starpat= 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3649 " call Decho("default case: starpat=".starpat)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3650 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3651
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3652 if starpat == 0 && a:indx >= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3653 " [Explore Hexplore Vexplore Sexplore] [dirname]
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3654 " 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
3655 if dirname == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3656 let dirname= curfiledir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3657 " call Decho("empty dirname, using current file's directory<".dirname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3658 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3659 if dirname =~ '^scp:' || dirname =~ '^ftp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3660 " call Decho("calling NetrwBrowse(0,dirname<".dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3661 call s:NetrwBrowse(0,dirname)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3662 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3663 if dirname == ""|let dirname= getcwd()|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3664 " call Decho("calling LocalBrowseCheck(dirname<".dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3665 call netrw#LocalBrowseCheck(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3666 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3667
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3668 " call Decho("curdir<".curdir.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3669 if has("win32") || has("win95") || has("win64") || has("win16")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3670 keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3671 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3672 keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3673 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3674
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3675 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3676 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3677 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3678 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3679 elseif a:indx <= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3680 " Nexplore, Pexplore, Explore: handle starpat
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3681 " 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
3682 if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3683 " call Decho("set up <s-up> and <s-down> maps")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3684 let s:didstarstar= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3685 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3686 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3687 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3688
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3689 if has("path_extra")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3690 " call Decho("starpat=".starpat.": has +path_extra")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3691 if !exists("w:netrw_explore_indx")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3692 let w:netrw_explore_indx= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3693 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3694
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3695 let indx = a:indx
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3696 " call Decho("starpat=".starpat.": set indx= [a:indx=".indx."]")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3697
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3698 if indx == -1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3699 " Nexplore
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3700 " call Decho("case Nexplore with starpat=".starpat.": (indx=".indx.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3701 if !exists("w:netrw_explore_list") " sanity check
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3702 call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3703 sil! let @* = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3704 sil! let @+ = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3705 sil! let @/ = keepregslash
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3706 " call Dret("netrw#Explore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3707 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3708 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3709 let indx= w:netrw_explore_indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3710 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3711 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
3712 let curfile= w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3713 " call Decho("indx=".indx." curfile<".curfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3714 while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3715 let indx= indx + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3716 " call Decho("indx=".indx." (Nexplore while loop)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3717 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3718 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
3719 " call Decho("Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3720
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3721 elseif indx == -2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3722 " Pexplore
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3723 " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3724 if !exists("w:netrw_explore_list") " sanity check
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3725 call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3726 sil! let @* = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3727 sil! let @+ = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3728 sil! let @/ = keepregslash
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3729 " call Dret("netrw#Explore")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3730 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3731 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3732 let indx= w:netrw_explore_indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3733 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3734 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
3735 let curfile= w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3736 " call Decho("indx=".indx." curfile<".curfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3737 while indx >= 0 && curfile == w:netrw_explore_list[indx]
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3738 let indx= indx - 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3739 " call Decho("indx=".indx." (Pexplore while loop)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3740 endwhile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3741 if indx < 0 | let indx= 0 | endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3742 " call Decho("Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3743
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3744 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3745 " Explore -- initialize
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3746 " build list of files to Explore with Nexplore/Pexplore
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3747 " call Decho("starpat=".starpat.": case Explore: initialize (indx=".indx.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3748 call s:NetrwClearExplore()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3749 let w:netrw_explore_indx= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3750 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3751 let b:netrw_curdir= getcwd()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3752 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3753 " call Decho("starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3754
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3755 " switch on starpat to build the w:netrw_explore_list of files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3756 if starpat == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3757 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3758 " call Decho("starpat=".starpat.": build *//pattern list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3759 " call Decho("pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3760 try
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3761 exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3762 catch /^Vim\%((\a\+)\)\=:E480/
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3763 call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3764 " call Dret("netrw#Explore : unable to find pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3765 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3766 endtry
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3767 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
3768 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3769
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3770 elseif starpat == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3771 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3772 " call Decho("starpat=".starpat.": build **//pattern list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3773 try
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3774 exe "sil keepj noautocmd vimgrep /".pattern."/gj "."**/*"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3775 catch /^Vim\%((\a\+)\)\=:E480/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3776 call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3777 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3778 silent! let @* = keepregstar
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3779 silent! let @+ = keepregstar
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3780 silent! let @/ = keepregslash
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3781 " call Dret("netrw#Explore : no files matched pattern")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3782 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3783 endtry
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3784 let s:netrw_curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3785 let w:netrw_explore_list = getqflist()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3786 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
3787
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3788 elseif starpat == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3789 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3790 " call Decho("starpat=".starpat.": build */filepat list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3791 let filepat= substitute(dirname,'^\*/','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3792 let filepat= substitute(filepat,'^[%#<]','\\&','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3793 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3794 " call Decho("filepat<".filepat.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3795 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
3796 if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3797
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3798 elseif starpat == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3799 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3800 " call Decho("starpat=".starpat.": build **/filepat list")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3801 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
3802 if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3803 endif " switch on starpat to build w:netrw_explore_list
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3804
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3805 let w:netrw_explore_listlen = len(w:netrw_explore_list)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3806 " call Decho("w:netrw_explore_list<".string(w:netrw_explore_list).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3807 " call Decho("w:netrw_explore_listlen=".w:netrw_explore_listlen)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3808
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3809 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
3810 call netrw#ErrorMsg(s:WARNING,"no files matched",42)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3811 sil! let @* = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3812 sil! let @+ = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3813 sil! let @/ = keepregslash
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3814 " call Dret("netrw#Explore : no files matched")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3815 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3816 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3817 endif " if indx ... endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3818
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3819 " NetrwStatusLine support - for exploring support
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3820 let w:netrw_explore_indx= indx
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3821 " 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
3822
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3823 " wrap the indx around, but issue a note
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3824 if indx >= w:netrw_explore_listlen || indx < 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3825 " call Decho("wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3826 let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3827 let w:netrw_explore_indx= indx
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3828 call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3829 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3830
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3831 exe "let dirfile= w:netrw_explore_list[".indx."]"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3832 " call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3833 let newdir= substitute(dirfile,'/[^/]*$','','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3834 " call Decho("newdir<".newdir.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3835
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3836 " call Decho("calling LocalBrowseCheck(newdir<".newdir.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3837 call netrw#LocalBrowseCheck(newdir)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3838 if !exists("w:netrw_liststyle")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3839 let w:netrw_liststyle= g:netrw_liststyle
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3840 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3841 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3842 keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3843 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3844 keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3845 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3846 let w:netrw_explore_mtchcnt = indx + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3847 let w:netrw_explore_bufnr = bufnr("%")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3848 let w:netrw_explore_line = line(".")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3849 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3850 " 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
3851
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3852 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3853 " call Decho("your vim does not have +path_extra")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3854 if !exists("g:netrw_quiet")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3855 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
3856 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3857 sil! let @* = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3858 sil! let @+ = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3859 sil! let @/ = keepregslash
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3860 " call Dret("netrw#Explore : missing +path_extra")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3861 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3862 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3863
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3864 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3865 " call Decho("default case: Explore newdir<".dirname.">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3866 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3867 sil! unlet w:netrw_treedict
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3868 sil! unlet w:netrw_treetop
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3869 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3870 let newdir= dirname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3871 if !exists("b:netrw_curdir")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3872 call netrw#LocalBrowseCheck(getcwd())
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3873 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3874 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3875 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3876 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3877
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3878 " visual display of **/ **// */ Exploration files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3879 " 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
3880 " 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
3881 if exists("w:netrw_explore_indx") && exists("b:netrw_curdir")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3882 " 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
3883 if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3884 " 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
3885 " 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
3886 let s:explore_prvdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3887 let s:explore_match = ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3888 let dirlen = s:Strlen(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3889 if b:netrw_curdir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3890 let dirlen= dirlen + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3891 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3892 let prvfname= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3893 for fname in w:netrw_explore_list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3894 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3895 if fname =~ '^'.b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3896 if s:explore_match == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3897 let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3898 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3899 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
3900 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3901 elseif fname !~ '^/' && fname != prvfname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3902 if s:explore_match == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3903 let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3904 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3905 let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3906 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3907 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3908 let prvfname= fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3909 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3910 " call Decho("explore_match<".s:explore_match.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3911 exe "2match netrwMarkFile /".s:explore_match."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3912 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3913 echo "<s-up>==Pexplore <s-down>==Nexplore"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3914 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3915 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3916 if exists("s:explore_match") | unlet s:explore_match | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3917 if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3918 echo " "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3919 " call Decho("cleared explore match list")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3920 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3921
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3922 sil! let @* = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3923 sil! let @+ = keepregstar
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3924 sil! let @/ = keepregslash
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3925 " call Dret("netrw#Explore : @/<".@/.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3926 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3927
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3928 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3929 " s:NetrwExploreListUniq: {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3930 fun! s:NetrwExploreListUniq(explist)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3931 " call Dfunc("s:NetrwExploreListUniq(explist)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3932
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3933 " this assumes that the list is already sorted
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3934 let newexplist= []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3935 for member in a:explist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3936 if !exists("uniqmember") || member != uniqmember
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3937 let uniqmember = member
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3938 let newexplist = newexplist + [ member ]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3939 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3940 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3941
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3942 " call Dret("s:NetrwExploreListUniq")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3943 return newexplist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3944 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3945
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3946 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3947 " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3948 " and switches the hiding mode. The actual hiding is done by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3949 " s:NetrwListHide().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3950 " g:netrw_hide= 0: show all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3951 " 1: show not-hidden files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3952 " 2: show hidden files only
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3953 fun! s:NetrwHide(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3954 " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3955 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3956
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3957 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3958 " 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
3959 " call Decho("g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3960
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3961 " hide the files in the markfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3962 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3963 " 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
3964 if match(g:netrw_list_hide,'\<'.fname.'\>') != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3965 " remove fname from hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3966 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
3967 let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3968 let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3969 " call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3970 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3971 " append fname to hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3972 if exists("g:netrw_list_hide") && g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3973 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
3974 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3975 let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3976 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3977 " call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3978 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3979 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3980 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3981 let g:netrw_hide= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3982
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3983 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3984
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3985 " switch between show-all/show-not-hidden/show-hidden
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3986 let g:netrw_hide=(g:netrw_hide+1)%3
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3987 exe "keepj norm! 0"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3988 if g:netrw_hide && g:netrw_list_hide == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3989 call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3990 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3991 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3992 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3993 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3994
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3995 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3996 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3997 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3998 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3999
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4000 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4001 " s:NetrwHidden: invoked by "gh" {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4002 fun! s:NetrwHidden(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4003 " call Dfunc("s:NetrwHidden()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4004 " save current position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4005 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4006
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4007 if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4008 " remove pattern from hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4009 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
4010 elseif s:Strlen(g:netrw_list_hide) >= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4011 let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4012 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4013 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4014 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4015
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4016 " refresh screen and return to saved position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4017 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4018 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4019 " call Dret("s:NetrwHidden")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4020 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4021
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4022 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4023 " 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
4024 fun! s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4025 if exists("g:netrw_home")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4026 let home= g:netrw_home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4027 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4028 " go to vim plugin home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4029 for home in split(&rtp,',') + ['']
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4030 if isdirectory(home) && filewritable(home) | break | endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4031 let basehome= substitute(home,'[/\\]\.vim$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4032 if isdirectory(basehome) && filewritable(basehome)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4033 let home= basehome."/.vim"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4034 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4035 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4036 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4037 if home == ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4038 " just pick the first directory
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4039 let home= substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4040 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4041 if (has("win32") || has("win95") || has("win64") || has("win16"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4042 let home= substitute(home,'/','\\','g')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4043 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4044 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4045 " insure that the home directory exists
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4046 if !isdirectory(home)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4047 if exists("g:netrw_mkdir")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4048 call system(g:netrw_mkdir." ".shellescape(home))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4049 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4050 call mkdir(home)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4051 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4052 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4053 let g:netrw_home= home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4054 return home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4055 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4056
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4057 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4058 " s:NetrwLeftmouse: handles the <leftmouse> when in a netrw browsing window {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4059 fun! s:NetrwLeftmouse(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4060 " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4061
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4062 " check if the status bar was clicked on instead of a file/directory name
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4063 call feedkeys("\<LeftMouse>")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4064 let c= getchar()
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4065 let mouse_lnum = v:mouse_lnum
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4066 let wlastline = line('w$')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4067 let lastline = line('$')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4068 " call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr())
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4069 " call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0))
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4070 if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr()
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4071 " appears to be a status bar leftmouse click
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4072 " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4073 return
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4074 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4075 if v:mouse_col != col('.')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4076 " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4077 return
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4078 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4079
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4080 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4081 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4082 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4083 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4084 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4085 if exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4086 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4087 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4088 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4089 " call Dret("s:NetrwLeftmouse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4090 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4091
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4092 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4093 " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4094 " separated patterns given in g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4095 fun! s:NetrwListHide()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4096 " call Dfunc("NetrwListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4097
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4098 " 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
4099 " How-it-works: take the hiding command, convert it into a range. Duplicate
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4100 " characters don't matter. Remove all such characters from the '/~...90'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4101 " string. Use the first character left as a separator character.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4102 let listhide= g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4103 let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4104 " call Decho("sep=".sep)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4105
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4106 while listhide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4107 if listhide =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4108 let hide = substitute(listhide,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4109 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4110 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4111 let hide = listhide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4112 let listhide = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4113 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4114
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4115 " Prune the list by hiding any files which match
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4116 if g:netrw_hide == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4117 " call Decho("hiding<".hide."> listhide<".listhide.">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4118 exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4119 elseif g:netrw_hide == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4120 " call Decho("showing<".hide."> listhide<".listhide.">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4121 exe 'sil keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4122 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4123 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4124 if g:netrw_hide == 2
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4125 exe 'sil keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4126 exe 'sil keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4127 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4128
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4129 " call Dret("NetrwListHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4130 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4131
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4132 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4133 " NetrwHideEdit: allows user to edit the file/directory hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4134 fun! s:NetrwHideEdit(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4135 " call Dfunc("NetrwHideEdit(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4136
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4137 " save current cursor position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4138 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4139
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4140 " get new hiding list from user
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4141 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4142 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4143 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4144 let g:netrw_list_hide= newhide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4145 " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4146
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4147 " refresh the listing
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4148 silent keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4149
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4150 " restore cursor position
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4151 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4152
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4153 " call Dret("NetrwHideEdit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4154 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4155
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4156 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4157 " NetSortSequence: allows user to edit the sorting sequence
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4158 fun! s:NetSortSequence(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4159 " call Dfunc("NetSortSequence(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4160
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4161 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4162 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4163 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4164 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4165
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4166 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4167 let g:netrw_sort_sequence= newsortseq
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4168 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4169 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4170
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4171 " call Dret("NetSortSequence")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4172 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4173
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4174 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4175 " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4176 fun! s:NetrwMakeDir(usrhost)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4177 " call Dfunc("NetrwMakeDir(usrhost<".a:usrhost.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4178
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4179 " get name of new directory from user. A bare <CR> will skip.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4180 " if its currently a directory, also request will be skipped, but with
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4181 " a message.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4182 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4183 let newdirname= input("Please give directory name: ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4184 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4185 " call Decho("newdirname<".newdirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4186
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4187 if newdirname == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4188 " call Dret("NetrwMakeDir : user aborted with bare <cr>")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4189 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4190 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4191
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4192 if a:usrhost == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4193 " call Decho("local mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4194
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4195 " Local mkdir:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4196 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4197 let fullnewdir= b:netrw_curdir.'/'.newdirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4198 " call Decho("fullnewdir<".fullnewdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4199 if isdirectory(fullnewdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4200 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4201 call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24)
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 " call Dret("NetrwMakeDir : directory<".newdirname."> exists previously")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4204 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4205 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4206 if s:FileReadable(fullnewdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4207 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4208 call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4209 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4210 " call Dret("NetrwMakeDir : file<".newdirname."> exists previously")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4211 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4212 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4213
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4214 " requested new local directory is neither a pre-existing file or
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4215 " directory, so make it!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4216 if exists("*mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4217 call mkdir(fullnewdir,"p")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4218 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4219 let netrw_origdir= s:NetrwGetcwd(1)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4220 exe 'keepj lcd '.fnameescape(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4221 " 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
4222 " call Decho("exe silent! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4223 exe "sil! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4224 if !g:netrw_keepdir
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4225 exe 'keepj lcd '.fnameescape(netrw_origdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4226 " 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
4227 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4228 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4229
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4230 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4231 " refresh listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4232 " call Decho("refresh listing")
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 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4235 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4236 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4237 call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4238 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4239 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4240
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4241 elseif !exists("b:netrw_method") || b:netrw_method == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4242 " Remote mkdir:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4243 " call Decho("remote mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4244 let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4245 let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4246 " call Decho("exe silent! !".mkdircmd." ".shellescape(newdirname,1))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4247 exe "sil! !".mkdircmd." ".shellescape(newdirname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4248 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4249 " refresh listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4250 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4251 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4252 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4253 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4254 call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4255 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4256 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4257
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4258 elseif b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4259 " COMBAK -- future work
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4260 call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4261 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4262 " COMBAK -- future work
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4263 call netrw#ErrorMsg(s:ERROR,"making directories via ftp not currently supported",68)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4264 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4265
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4266 " call Dret("NetrwMakeDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4267 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4268
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4269 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4270 " s:NetrwMarkFile: (invoked by mf) This function is used to both {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4271 " mark and unmark files. If a markfile list exists,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4272 " then the rename and delete functions will use it instead
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4273 " of whatever may happen to be under the cursor at that
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4274 " moment. When the mouse and gui are available,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4275 " shift-leftmouse may also be used to mark files.
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4276 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4277 " Creates two lists
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4278 " s:netrwmarkfilelist -- holds complete paths to all marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4279 " 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
4280 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4281 " Creates a marked file match string
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4282 " s:netrwmarfilemtch_# -- used with 2match to display marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4283 "
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4284 " Creates a buffer version of islocal
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4285 " b:netrw_islocal
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4286 "
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4287 fun! s:NetrwMarkFile(islocal,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4288 " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4289 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4290 let curdir = b:netrw_curdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4291 let trailer = '[@=|\/\*]\=\>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4292 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4293 " markfile list exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4294 " call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4295 " call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">")
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4296 let b:netrw_islocal= a:islocal
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4297
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4298 if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4299 " append filename to buffer's markfilelist
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4300 " 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
4301 call add(s:netrwmarkfilelist_{curbufnr},a:fname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4302 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
4303
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4304 else
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
4305 " remove filename from buffer's markfilelist
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4306 " 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
4307 call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4308 if s:netrwmarkfilelist_{curbufnr} == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4309 " local markfilelist is empty; remove it entirely
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4310 " call Decho("markfile list now empty")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4311 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4312 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4313 " rebuild match list to display markings correctly
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4314 " call Decho("rebuild s:netrwmarkfilemtch_".curbufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4315 let s:netrwmarkfilemtch_{curbufnr}= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4316 let first = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4317 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4318 if first
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4319 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
4320 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4321 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
4322 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4323 let first= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4324 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4325 " call Decho("ending s:netrwmarkfilelist_"curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4326 " call Decho("ending s:netrwmarkfilemtch_"curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4327 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4328 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4329
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4330 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4331 " initialize new markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4332
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4333 " call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4334 let s:netrwmarkfilelist_{curbufnr}= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4335 call add(s:netrwmarkfilelist_{curbufnr},a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4336 " call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4337
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4338 " build initial markfile matching pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4339 if a:fname =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4340 let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4341 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4342 let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4343 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4344 " call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4345 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4347 " handle global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4348 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4349 let dname= s:ComposePath(b:netrw_curdir,a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4350 if index(s:netrwmarkfilelist,dname) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4351 " append new filename to global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4352 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4353 " call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4354 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4355 " remove new filename from global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4356 " call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4357 call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4358 " call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4359 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4360 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4361 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4362 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4363 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4364 " initialize new global-directory markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4365 let s:netrwmarkfilelist= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4366 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4367 " call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4368 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4369
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4370 " set up 2match'ing to netrwmarkfilemtch list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4371 if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4372 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4373 if exists("g:did_drchip_netrwlist_syntax")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4374 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4375 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4376 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4377 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4378 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4379 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4380 " 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
4381 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4382
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4383 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4384 " s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4385 " compress/decompress files using the programs
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4386 " in g:netrw_compress and g:netrw_uncompress,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4387 " using g:netrw_compress_suffix to know which to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4388 " do. By default:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4389 " g:netrw_compress = "gzip"
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
4390 " g:netrw_decompress = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf", ".xz" : "unxz"}
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4391 fun! s:NetrwMarkFileCompress(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4392 " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4393 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4394 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4395 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4396
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4397 if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4398 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4399 " for every filename in the marked list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4400 for sfx in sort(keys(g:netrw_decompress))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4401 if fname =~ '\'.sfx.'$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4402 " 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
4403 let exe= netrw#WinPath(g:netrw_decompress[sfx])
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4404 " call Decho("fname<".fname."> is compressed so decompress with <".exe.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4405 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4406 if g:netrw_keepdir
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4407 let fname= shellescape(s:ComposePath(curdir,fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4408 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4409 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4410 let fname= shellescape(b:netrw_curdir.fname,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4411 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4412 if executable(exe)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4413 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4414 call system(exe." ".fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4415 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4416 call s:RemoteSystem(exe." ".fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4417 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4418 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4419 call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4420 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4421 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4422 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
4423 unlet sfx
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4424 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4425 if exists("exe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4426 unlet exe
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4427 elseif a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4428 " fname not a compressed file, so compress it
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4429 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
4430 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4431 " fname not a compressed file, so compress it
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4432 call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4433 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4434 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4435 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4436 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4437 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4438 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4439 " call Dret("s:NetrwMarkFileCompress")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4440 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4441
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4442 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4443 " s:NetrwMarkFileCopy: (invoked by mc) copy marked files to target {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4444 " If no marked files, then set up directory as the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4445 " target. Currently does not support copying entire
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4446 " directories. Uses the local-buffer marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4447 " Returns 1=success (used by NetrwMarkFileMove())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4448 " 0=failure
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4449 fun! s:NetrwMarkFileCopy(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4450 " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---').">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4451
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4452 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4453 if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4454 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
4455 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4456 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4457 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4458 " call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')}))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4459 if !exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4460 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
4461 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4462 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4463 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4464 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4465 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4466 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4467
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4468 if a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4469 " Copy marked files, local directory to local directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4470 " call Decho("copy from local to local")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4471 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
4472 " call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4473 call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4474
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4475 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4476 " Copy marked files, local directory to remote directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4477 " call Decho("copy from local to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4478 call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4479
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4480 elseif !a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4481 " call Decho("copy from remote to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4482 call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4483
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4484 elseif !a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4485 " call Decho("copy from remote to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4486 let curdir = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4487 let tmpdir = s:GetTempfile("")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4488 if tmpdir !~ '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4489 let tmpdir= curdir."/".tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4490 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4491 if exists("*mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4492 call mkdir(tmpdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4493 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4494 exe "sil! !".g:netrw_local_mkdir.' '.shellescape(tmpdir,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4495 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4496 if isdirectory(tmpdir)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4497 exe "keepj lcd ".fnameescape(tmpdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4498 call netrw#NetrwObtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4499 let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4500 call s:NetrwUpload(localfiles,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4501 if getcwd() == tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4502 for fname in s:netrwmarkfilelist_{bufnr('%')}
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4503 call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4504 endfor
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4505 exe "keepj lcd ".fnameescape(curdir)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4506 exe "sil !".g:netrw_local_rmdir." ".shellescape(tmpdir,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4507 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4508 exe "keepj lcd ".fnameescape(curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4509 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4510 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4511 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4512
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4513 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4514 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4515 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4516 " call Decho("cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4517
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4518 " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4519 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4520
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4521 " refresh buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4522 if !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4523 call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4524 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4525 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4526 call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4527 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4528 if g:netrw_fastbrowse <= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4529 call s:LocalBrowseShellCmdRefresh()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4530 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4531
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4532 " call Dret("s:NetrwMarkFileCopy 1")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4533 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4534 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4535
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4536 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4537 " s:NetrwMarkFileDiff: (invoked by md) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4538 " invoke vim's diff mode on the marked files.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4539 " Either two or three files can be so handled.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4540 " Uses the global marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4541 fun! s:NetrwMarkFileDiff(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4542 " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4543 let curbufnr= bufnr("%")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4544
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4545 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4546 let cnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4547 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4548 for fname in s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4549 let cnt= cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4550 if cnt == 1
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4551 " call Decho("diffthis: fname<".fname.">")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4552 exe "e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4553 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4554 elseif cnt == 2 || cnt == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4555 vsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4556 wincmd l
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4557 " call Decho("diffthis: ".fname)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4558 exe "e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4559 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4560 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4561 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4562 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4563 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4564 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4565 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4566
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4567 " call Dret("s:NetrwMarkFileDiff")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4568 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4569
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4570 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4571 " 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
4572 " Uses global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4573 fun! s:NetrwMarkFileEdit(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4574 " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4575
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4576 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4577 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4578 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4579 call s:SetRexDir(a:islocal,curdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4580 let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4581 " unmark markedfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4582 " call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4583 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4584 " call Decho("exe silent args ".flist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4585 exe "silent args ".flist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4586 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4587
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4588 " call Dret("s:NetrwMarkFileEdit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4589 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4590
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4591 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4592 " 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
4593 " Uses the local marked-file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4594 fun! s:NetrwMarkFileExe(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4595 " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4596 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4597 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4598 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4599
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4600 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4601 " get the command
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4602 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4603 let cmd= input("Enter command: ","","file")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4604 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4605 " call Decho("cmd<".cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4606
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4607 " apply command to marked files. Substitute: filename -> %
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4608 " If no %, then append a space and the filename to the command
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4609 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4610 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4611 if g:netrw_keepdir
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4612 let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname)))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4613 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4614 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4615 let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4616 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4617 if cmd =~ '%'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4618 let xcmd= substitute(cmd,'%',fname,'g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4619 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4620 let xcmd= cmd.' '.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4621 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4622 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4623 " call Decho("local: xcmd<".xcmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4624 let ret= system(xcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4625 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4626 " call Decho("remote: xcmd<".xcmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4627 let ret= s:RemoteSystem(xcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4628 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4629 if v:shell_error < 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4630 call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4631 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4632 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4633 echo ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4634 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4635 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4636
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4637 " unmark marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4638 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4639
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4640 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4641 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4642 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4643 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4644 call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4645 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4646
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4647 " call Dret("s:NetrwMarkFileExe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4648 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4649
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4650 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4651 " s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4652 " as the marked file(s) (toggles suffix presence)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4653 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4654 fun! s:NetrwMarkHideSfx(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4655 " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4656 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4657 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4658
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4659 " s:netrwmarkfilelist_{curbufnr}: the List of marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4660 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4661
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4662 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4663 " call Decho("s:NetrwMarkFileCopy: fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4664 " construct suffix pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4665 if fname =~ '\.'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4666 let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4667 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4668 let sfxpat= '^\%(\%(\.\)\@!.\)*$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4669 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4670 " determine if its in the hiding list or not
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4671 let inhidelist= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4672 if g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4673 let itemnum = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4674 let hidelist= split(g:netrw_list_hide,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4675 for hidepat in hidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4676 if sfxpat == hidepat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4677 let inhidelist= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4678 break
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 let itemnum= itemnum + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4681 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4682 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4683 " call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4684 if inhidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4685 " remove sfxpat from list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4686 call remove(hidelist,itemnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4687 let g:netrw_list_hide= join(hidelist,",")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4688 elseif g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4689 " append sfxpat to non-empty list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4690 let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4691 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4692 " set hiding list to sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4693 let g:netrw_list_hide= sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4694 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4695 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4696
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4697 " refresh the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4698 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4699 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4700 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4701 call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4702 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4703
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4704 " call Dret("s:NetrwMarkHideSfx")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4705 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4706
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4707 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4708 " s:NetrwMarkFileGrep: (invoked by mg) This function applies vimgrep to marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4709 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4710 fun! s:NetrwMarkFileGrep(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4711 " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4712 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4713 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4714
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4715 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4716 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4717 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4718 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4719
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4720 " ask user for pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4721 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4722 let pat= input("Enter pattern: ","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4723 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4724 if pat !~ '^\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4725 if pat !~ '^/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4726 let pat= '/'.pat.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4727 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4728 let pat= " ".pat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4729 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4730
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4731 " use vimgrep for both local and remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4732 " call Decho("exe vimgrep".pat." ".netrwmarkfilelist)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4733 try
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4734 exe "keepj noautocmd vimgrep".pat." ".netrwmarkfilelist
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4735 catch /^Vim\%((\a\+)\)\=:E480/
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4736 call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4737 " call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4738 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4739 endtry
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 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4742 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4743 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4744
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4745 " call Dret("s:NetrwMarkFileGrep")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4746 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4747
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4748 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4749 " 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
4750 " uses the global marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4751 " s:netrwmfloc= 0: target directory is remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4752 " = 1: target directory is local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4753 fun! s:NetrwMarkFileMove(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4754 " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4755 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4756 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4757
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4758 " sanity check
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4759 if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4760 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
4761 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4762 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4763 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4764 " call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')}))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4765 if !exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4766 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
4767 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4768 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4769 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4770 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4771
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4772 if a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4773 " move: local -> local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4774 " call Decho("move from local to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4775 " call Decho("(s:NetrwMarkFileMove) local to local move")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4776 if executable(g:netrw_localmovecmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4777 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4778 " call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4779 let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4780 if v:shell_error < 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4781 call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4782 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4783 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4784 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4785 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4786 call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> is not executable!",57)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4787 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4788
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4789 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4790 " move: local -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4791 " call Decho("move from local to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4792 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4793 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4794 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4795 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4796 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4797 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4798 let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4799 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4800 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4801
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4802 elseif !a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4803 " move: remote -> local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4804 " call Decho("move from remote to local")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4805 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4806 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4807 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4808 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4809 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4810 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4811 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4812 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4813 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4814
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4815 elseif !a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4816 " move: remote -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4817 " call Decho("move from remote to remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4818 " call Decho("copy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4819 let mflist= s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4820 call s:NetrwMarkFileCopy(a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4821 " call Decho("remove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4822 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4823 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4824 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4825 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4826 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4827 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4828
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4829 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4830 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4831 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4832 " call Decho("cleanup")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4833
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4834 " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4835 call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4836
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4837 " refresh buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4838 if !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4839 call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4840 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4841 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4842 call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4843 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4844 if g:netrw_fastbrowse <= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4845 call s:LocalBrowseShellCmdRefresh()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4846 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4847
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4848 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4849 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4850
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4851 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4852 " s:NetrwMarkFilePrint: (invoked by mp) This function prints marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4853 " using the hardcopy command. Local marked-file list only.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4854 fun! s:NetrwMarkFilePrint(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4855 " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4856 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4857 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4858 let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4859 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4860 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4861 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4862 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4863 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4864 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4865 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4866 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4867 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4868 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4869 1split
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4870 " the autocmds will handle both local and remote files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4871 " call Decho("exe silent e ".escape(fname,' '))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4872 exe "silent e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4873 " call Decho("hardcopy")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4874 hardcopy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4875 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4876 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4877 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4878 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4879 " call Dret("s:NetrwMarkFilePrint")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4880 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4881
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4882 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4883 " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4884 " files when given a regexp (for which a prompt is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4885 " issued).
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4886 fun! s:NetrwMarkFileRegexp(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4887 " call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4888
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4889 " get the regular expression
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4890 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4891 let regexp= input("Enter regexp: ","","file")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4892 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4893
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4894 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4895 " get the matching list of files using local glob()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4896 " call Decho("handle local regexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4897 let dirname = escape(b:netrw_curdir,g:netrw_glob_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4898 let files = glob(s:ComposePath(dirname,regexp))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4899 " call Decho("files<".files.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4900 let filelist= split(files,"\n")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4901
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4902 " mark the list of files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4903 for fname in filelist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4904 " call Decho("fname<".fname.">")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4905 call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','',''))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4906 endfor
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4907
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4908 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4909 " call Decho("handle remote regexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4910
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4911 " convert displayed listing into a filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4912 let eikeep = &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4913 let areg = @a
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4914 sil keepj %y a
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4915 set ei=all ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4916 " call Decho("set ei=all ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4917 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4918 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4919 call s:NetrwSafeOptions()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4920 sil keepj norm! "ap
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4921 keepj 2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4922 let bannercnt= search('^" =====','W')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4923 exe "sil keepj 1,".bannercnt."d"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4924 set bt=nofile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4925 if g:netrw_liststyle == s:LONGLIST
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4926 sil keepj %s/\s\{2,}\S.*$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4927 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4928 elseif g:netrw_liststyle == s:WIDELIST
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4929 sil keepj %s/\s\{2,}/\r/ge
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4930 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4931 elseif g:netrw_liststyle == s:TREELIST
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4932 sil keepj %s/^| //e
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4933 sil! keepj g/^ .*$/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4934 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4935 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4936 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4937 " convert regexp into the more usual glob-style format
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4938 let regexp= substitute(regexp,'\*','.*','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4939 " call Decho("regexp<".regexp.">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4940 exe "sil! keepj v/".escape(regexp,'/')."/d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4941 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4942 let filelist= getline(1,line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4943 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4944 for filename in filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4945 call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','',''))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4946 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4947 unlet filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4948 let @a = areg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4949 let &ei = eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4950 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4951
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4952 " call Dret("s:NetrwMarkFileRegexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4953 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4954
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4955 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4956 " s:NetrwMarkFileSource: (invoked by ms) This function sources marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4957 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4958 fun! s:NetrwMarkFileSource(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4959 " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4960 let curbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4961 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4962 let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4963 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4964 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4965 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4966 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4967 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4968 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4969 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4970 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4971 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4972 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4973 " the autocmds will handle sourcing both local and remote files
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4974 " call Decho("exe so ".fnameescape(fname))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4975 exe "so ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4976 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4977 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4978 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4979 " call Dret("s:NetrwMarkFileSource")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4980 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4981
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4982 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4983 " 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
4984 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4985 fun! s:NetrwMarkFileTag(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4986 " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4987 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4988 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4989 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4990
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4991 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4992 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
4993 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4994 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4995
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4996 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4997 if executable(g:netrw_ctags)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4998 " call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4999 call system(g:netrw_ctags." ".netrwmarkfilelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5000 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5001 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
5002 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5003 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5004 let cmd = s:RemoteSystem(g:netrw_ctags." ".netrwmarkfilelist)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5005 call netrw#NetrwObtain(a:islocal,"tags")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5006 let curdir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5007 1split
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5008 e tags
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5009 let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5010 " call Decho("curdir<".curdir."> path<".path.">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5011 exe 'keepj %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
5012 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5013 wq!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5014 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5015 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5016 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5017 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5018 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5019
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5020 " call Dret("s:NetrwMarkFileTag")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5021 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5022
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5023 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5024 " 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
5025 " Sets up two variables,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5026 " s:netrwmftgt : holds the target directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5027 " s:netrwmftgt_islocal : 0=target directory is remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5028 " 1=target directory is local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5029 fun! s:NetrwMarkFileTgt(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5030 " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5031 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5032 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5033 let hadtgt = exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5034 if !exists("w:netrw_bannercnt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5035 let w:netrw_bannercnt= b:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5036 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5037
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5038 " set up target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5039 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5040 " if cursor in banner region, use b:netrw_curdir for the target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5041 let s:netrwmftgt= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5042 " call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5043
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5044 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5045 " get word under cursor.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5046 " * If directory, use it for the target.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5047 " * If file, use b:netrw_curdir for the target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5048 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5049 let tgtdir = s:ComposePath(curdir,curword)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5050 if a:islocal && isdirectory(tgtdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5051 let s:netrwmftgt = tgtdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5052 " call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5053 elseif !a:islocal && tgtdir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5054 let s:netrwmftgt = tgtdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5055 " call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5056 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5057 let s:netrwmftgt = curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5058 " call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5059 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5060 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5061 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5062 " simplify the target (eg. /abc/def/../ghi -> /abc/ghi)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5063 let s:netrwmftgt= simplify(s:netrwmftgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5064 " call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5065 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5066 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5067 let s:netrwmftgt= substitute(system("cygpath ".shellescape(s:netrwmftgt)),'\n$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5068 let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5069 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5070 let s:netrwmftgt_islocal= a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5071
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5072 if g:netrw_fastbrowse <= 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5073 call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5074 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5075 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5076 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5077 if !hadtgt
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5078 sil! keepj norm! j
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5079 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5080
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5081 " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5082 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5083
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5084 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5085 " s:NetrwOpenFile: query user for a filename and open it {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5086 fun! s:NetrwOpenFile(islocal)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5087 " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5088 call inputsave()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5089 let fname= input("Enter filename: ")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5090 call inputrestore()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5091 if fname !~ '[/\\]'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5092 if exists("b:netrw_curdir")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5093 if exists("g:netrw_quiet")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5094 let netrw_quiet_keep = g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5095 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5096 let g:netrw_quiet = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5097 if b:netrw_curdir =~ '/$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5098 exe "e ".fnameescape(b:netrw_curdir.fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5099 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5100 exe "e ".fnameescape(b:netrw_curdir."/".fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5101 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5102 if exists("netrw_quiet_keep")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5103 let g:netrw_quiet= netrw_quiet_keep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5104 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5105 unlet g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5106 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5107 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5108 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5109 exe "e ".fnameescape(fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5110 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5111 " call Dret("s:NetrwOpenFile")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5112 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5113
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5114 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5115 " 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
5116 fun! s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5117 " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5118
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5119 " remove all files in local marked-file list from global list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5120 if exists("s:netrwmarkfilelist_{a:curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5121 for mfile in s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5122 let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5123 let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5124 call remove(s:netrwmarkfilelist,idx) " remove from global list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5125 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5126 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5127 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5128 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5129
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5130 " getting rid of the local marked-file lists is easy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5131 unlet s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5132 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5133 if exists("s:netrwmarkfilemtch_{a:curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5134 unlet s:netrwmarkfilemtch_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5135 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5136 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5137 " call Dret("s:NetrwUnmarkList")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5138 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5139
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5140 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5141 " s:NetrwUnmarkAll: remove the global marked file list and all local ones {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5142 fun! s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5143 " call Dfunc("s:NetrwUnmarkAll()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5144 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5145 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5146 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5147 silent call s:NetrwUnmarkAll2()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5148 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5149 " call Dret("s:NetrwUnmarkAll")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5150 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5151
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5152 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5153 " s:NetrwUnmarkAll2: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5154 fun! s:NetrwUnmarkAll2()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5155 " call Dfunc("s:NetrwUnmarkAll2()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5156 redir => netrwmarkfilelist_let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5157 let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5158 redir END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5159 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
5160 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
5161 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
5162 for flist in netrwmarkfilelist_list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5163 let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5164 unlet s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5165 unlet s:netrwmarkfilemtch_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5166 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5167 " call Dret("s:NetrwUnmarkAll2")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5168 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5169
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5170 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5171 " s:NetrwUnMarkFile: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5172 fun! s:NetrwUnMarkFile(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5173 " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5174 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5175 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5176
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5177 " unmark marked file list (although I expect s:NetrwUpload()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5178 " to do it, I'm just making sure)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5179 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5180 " call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5181 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5182 unlet s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5183 unlet s:netrwmarkfilemtch_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5184 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5185 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5186
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5187 " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5188 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5189 " call Dret("s:NetrwUnMarkFile")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5190 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5191
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5192 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5193 " s:NetrwMenu: generates the menu for gvim and netrw {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5194 fun! s:NetrwMenu(domenu)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5195
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5196 if !exists("g:NetrwMenuPriority")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5197 let g:NetrwMenuPriority= 80
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5198 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5199
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5200 if has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5201 " call Dfunc("NetrwMenu(domenu=".a:domenu.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5202
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5203 if !exists("s:netrw_menu_enabled") && a:domenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5204 " call Decho("initialize menu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5205 let s:netrw_menu_enabled= 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5206 exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5207 exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5208 exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5209 exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5210 exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb mb'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5211 exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u u'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5212 exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U U'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5213 exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb qb'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5214 exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'." \<c-h>'"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5215 exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S S'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5216 exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh gh"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5217 exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l> \<c-l>"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5218 exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5219 exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D'
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
5220 exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File<tab>% %'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5221 exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr> '."\<cr>"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5222 exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5223 exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5224 exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5225 exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5226 exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore '
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5227 exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5228 exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/ :Explore **/'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5229 exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *// :Explore *//'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5230 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **// :Explore **//'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5231 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore :Nexplore<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5232 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore :Pexplore<cr>'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5233 exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5234 exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ File<tab>mf mf'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5235 exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexp<tab>mr mr'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5236 exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Control<tab>a a'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5237 exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Target<tab>mc mc'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5238 exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.Delete<tab>D D'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5239 exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diff<tab>md md'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5240 exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Edit<tab>me me'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5241 exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmd<tab>mx mx'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5242 exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Target<tab>mm mm'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5243 exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.Obtain<tab>O O'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5244 exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Print<tab>mp mp'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5245 exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.Replace<tab>R R'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5246 exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Target<tab>mt mt'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5247 exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.Tag<tab>mT mT'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5248 exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompress<tab>mz mz'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5249 exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5250 exe 'sil! menu '.g:NetrwMenuPriority.'.16.1 '.g:NetrwTopLvlMenu.'Style.Listing\ Style\ (thin-long-wide-tree)<tab>i i'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5251 exe 'sil! menu '.g:NetrwMenuPriority.'.16.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show<tab>a a'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5252 exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order<tab>'."r r"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5253 exe 'sil! menu '.g:NetrwMenuPriority.'.16.4 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)<tab>s s'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5254 exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5255 exe 'sil! 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
5256 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
5257 let s:netrw_menucnt= 28
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5258
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5259 elseif !a:domenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5260 let s:netrwcnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5261 let curwin = winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5262 windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5263 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5264
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5265 if s:netrwcnt <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5266 " call Decho("clear menus")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5267 exe 'sil! unmenu '.g:NetrwTopLvlMenu
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5268 " call Decho('exe silent! unmenu '.g:NetrwTopLvlMenu.'*')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5269 sil! unlet s:netrw_menu_enabled
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5270 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5271 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5272 " call Dret("NetrwMenu")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5273 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5274
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5275 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5276
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5277 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5278 " s:NetrwObtain: obtain file under cursor or from markfile list {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5279 " Used by the O maps (as <SID>NetrwObtain())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5280 fun! s:NetrwObtain(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5281 " call Dfunc("NetrwObtain(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5282
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5283 if exists("s:netrwmarkfilelist_{bufnr('%')}")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5284 let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5285 call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')})
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5286 call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5287 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5288 call netrw#NetrwObtain(a:islocal,expand("<cWORD>"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5289 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5290
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5291 " call Dret("NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5292 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5293
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5294 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5295 " netrw#NetrwObtain: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5296 " netrw#NetrwObtain(islocal,fname[,tgtdirectory])
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5297 " islocal=0 obtain from remote source
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5298 " =1 obtain from local source
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5299 " fname : a filename or a list of filenames
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5300 " tgtdir : optional place where files are to go (not present, uses getcwd())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5301 fun! netrw#NetrwObtain(islocal,fname,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5302 " 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
5303 " NetrwStatusLine support - for obtaining support
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5304
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5305 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5306 let fnamelist= [ a:fname ]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5307 elseif type(a:fname) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5308 let fnamelist= a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5309 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5310 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
5311 " call Dret("netrw#NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5312 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5313 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5314 " call Decho("fnamelist<".string(fnamelist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5315 if a:0 > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5316 let tgtdir= a:1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5317 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5318 let tgtdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5319 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5320 " call Decho("tgtdir<".tgtdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5321
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5322 if exists("b:netrw_islocal") && b:netrw_islocal
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5323 " obtain a file from local b:netrw_curdir to (local) tgtdir
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5324 " call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5325 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5326 let topath= s:ComposePath(tgtdir,"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5327 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5328 " transfer files one at time
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5329 " call Decho("transfer files one at a time")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5330 for fname in fnamelist
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5331 " call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5332 call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5333 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5334 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5335 " transfer files with one command
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5336 " call Decho("transfer files with one command")
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5337 let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5338 " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5339 call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5340 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5341 elseif !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5342 call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5343 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5344 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
5345 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5347 else
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5348 " obtain files from remote b:netrw_curdir to local tgtdir
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
5349 " call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5350 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5351 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5352 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5353 call s:NetrwMethod(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5354
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5355 if b:netrw_method == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5356 " obtain file using scp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5357 " call Decho("obtain via scp (method#4)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5358 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5359 let useport= " ".g:netrw_scpport." ".g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5360 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5361 let useport= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5362 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5363 if b:netrw_fname =~ '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5364 let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5365 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5366 let path= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5367 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5368 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
5369 " 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
5370 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
5371
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5372 elseif b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5373 " obtain file using ftp + .netrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5374 " call Decho("obtain via ftp+.netrc (method #2)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5375 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5376 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5377 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5378 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5379 keepj put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5380 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5381 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5382
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5383 if exists("b:netrw_fname") && b:netrw_fname != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5384 call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5385 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5386 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5387
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5388 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5389 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5390 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5391 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5392 for fname in fnamelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5393 call setline(line("$")+1,'get "'.fname.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5394 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5395 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5396 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5397 " 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
5398 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
5399 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5400 " 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
5401 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
5402 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5403 " 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
5404 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5405 let debugkeep= &debug
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5406 setlocal debug=msg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5407 call netrw#ErrorMsg(s:ERROR,getline(1),4)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5408 let &debug= debugkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5409 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5410
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5411 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5412 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5413 " call Decho("obtain via ftp+mipf (method #3)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5414 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5415 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5416 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5417
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5418 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5419 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5420 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5421 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5422 keepj put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5423 " call Decho("filter input: ".getline('$'))
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5426 if exists("g:netrw_ftp") && g:netrw_ftp == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5427 keepj put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5428 " call Decho("filter input: ".getline('$'))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5429 keepj put ='\"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5430 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5431 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5432 keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5433 " call Decho("filter input: ".getline('$'))
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5436 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5437 keepj put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5438 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5439 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5440
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5441 if exists("b:netrw_fname") && b:netrw_fname != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5442 keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5443 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5444 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5445
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5446 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5447 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5448 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5449 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5450
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5451 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5452 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5453 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5454 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5455 for fname in fnamelist
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5456 keepj call setline(line("$")+1,'get "'.fname.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5457 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5458 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5459
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5460 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5461 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5462 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5463 " -n win32: quit being obnoxious about password
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5464 keepj norm! 1Gdd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5465 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5466 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5467 " 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
5468 if getline(1) !~ "^$"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5469 " call Decho("error<".getline(1).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5470 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5471 call netrw#ErrorMsg(s:ERROR,getline(1),5)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5472 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5473 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5474 elseif !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5475 " call Dfunc("netrw#NetrwObtain : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5476 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5477 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5478
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5479 " restore status line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5480 if type(a:fname) == 1 && exists("s:netrw_users_stl")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5481 call s:SetupNetrwStatusLine(s:netrw_users_stl)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5482 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5483
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5484 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5485
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5486 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5487 if exists("tmpbufnr")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5488 if bufnr("%") != tmpbufnr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5489 exe tmpbufnr."bw!"
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 q!
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 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5494
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5495 " call Dret("netrw#NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5496 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5497
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5498 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5499 " s:NetrwPrevWinOpen: open file/directory in previous window. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5500 " If there's only one window, then the window will first be split.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5501 " Returns:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5502 " choice = 0 : didn't have to choose
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5503 " choice = 1 : saved modified file in window first
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5504 " choice = 2 : didn't save modified file, opened window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5505 " choice = 3 : cancel open
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5506 fun! s:NetrwPrevWinOpen(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5507 " call Dfunc("NetrwPrevWinOpen(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5508
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5509 " 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
5510 let curdir = b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5511
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5512 " get last window number and the word currently under the cursor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5513 let lastwinnr = winnr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5514 let curword = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5515 let choice = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5516 " call Decho("lastwinnr=".lastwinnr." curword<".curword.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5517
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5518 let didsplit = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5519 if lastwinnr == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5520 " if only one window, open a new one first
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5521 " 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
5522 if g:netrw_preview
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5523 " 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
5524 exe (g:netrw_alto? "top " : "bot ")."vert ".g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5525 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5526 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5527 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5528 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5529 let didsplit = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5530
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5531 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5532 call s:SaveBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5533 " call Decho("wincmd p")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5534 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5535 call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5536 " if the previous window's buffer has been changed (is modified),
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5537 " and it doesn't appear in any other extant window, then ask the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5538 " user if s/he wants to abandon modifications therein.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5539 let bnr = winbufnr(0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5540 let bnrcnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5541 if &mod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5542 " 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
5543 let eikeep= &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5544 set ei=all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5545 windo if winbufnr(0) == bnr | let bnrcnt=bnrcnt+1 | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5546 exe bnr."wincmd p"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5547 let &ei= eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5548 " call Decho("bnr=".bnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5549 if bnrcnt == 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5550 let bufname = bufname(winbufnr(winnr()))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5551 let choice = confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5552 " call Decho("bufname<".bufname."> choice=".choice." winnr#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5553
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5554 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5555 " Yes -- write file & then browse
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5556 let v:errmsg= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5557 silent w
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5558 if v:errmsg != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5559 call netrw#ErrorMsg(s:ERROR,"unable to write <".bufname.">!",30)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5560 if didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5561 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5562 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5563 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5564 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5565 " call Dret("NetrwPrevWinOpen ".choice." : unable to write <".bufname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5566 return choice
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 elseif choice == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5570 " No -- don't worry about changed file, just browse anyway
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5571 setlocal nomod
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5572 call netrw#ErrorMsg(s:WARNING,bufname." changes to ".bufname." abandoned",31)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5573 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5574
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5575 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5576 " Cancel -- don't do this
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5577 if didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5578 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5579 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5580 wincmd p
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5581 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5582 " call Dret("NetrwPrevWinOpen ".choice." : cancelled")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5583 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5584 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5585 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5586 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5587 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5588
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5589 " restore b:netrw_curdir (window split/enew may have lost it)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5590 let b:netrw_curdir= curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5591 if a:islocal < 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5592 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5593 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5594 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5595 call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5596 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5597 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5598 " call Dret("NetrwPrevWinOpen ".choice)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5599 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5600 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5601
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5602 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5603 " s:NetrwUpload: load fname to tgt (used by NetrwMarkFileCopy()) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5604 " Always assumed to be local -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5605 " call s:NetrwUpload(filename, target)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5606 " call s:NetrwUpload(filename, target, fromdirectory)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5607 fun! s:NetrwUpload(fname,tgt,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5608 " 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
5609
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5610 if a:tgt =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5611 let tgtdir= substitute(a:tgt,'^\a\+://[^/]\+/\(.\{-}\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5612 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5613 let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5614 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5615 " call Decho("tgtdir<".tgtdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5616
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5617 if a:0 > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5618 let fromdir= a:1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5619 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5620 let fromdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5621 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5622 " call Decho("fromdir<".fromdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5623
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5624 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5625 " handle uploading a single file using NetWrite
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5626 " call Decho("handle uploading a single file via NetWrite")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5627 1split
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5628 " call Decho("exe e ".fnameescape(a:fname))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5629 exe "e ".fnameescape(a:fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5630 " call Decho("now locally editing<".expand("%").">, has ".line("$")." lines")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5631 if a:tgt =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5632 let wfname= substitute(a:fname,'^.*/','','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5633 " call Decho("exe w! ".fnameescape(wfname))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5634 exe "w! ".fnameescape(a:tgt.wfname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5635 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5636 " call Decho("writing local->remote: exe w ".fnameescape(a:tgt))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5637 exe "w ".fnameescape(a:tgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5638 " call Decho("done writing local->remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5639 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5640 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5641
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5642 elseif type(a:fname) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5643 " handle uploading a list of files via scp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5644 " call Decho("handle uploading a list of files via scp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5645 let curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5646 if a:tgt =~ '^scp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5647 exe "keepjumps silent lcd ".fnameescape(fromdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5648 let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')})
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
5649 let args = join(map(filelist,"shellescape(v:val, 1)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5650 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5651 let useport= " ".g:netrw_scpport." ".g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5652 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5653 let useport= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5654 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5655 let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5656 let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5657 " 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
5658 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
5659 exe "keepjumps silent lcd ".fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5660
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5661 elseif a:tgt =~ '^ftp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5662 call s:NetrwMethod(a:tgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5663
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5664 if b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5665 " handle uploading a list of files via ftp+.netrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5666 let netrw_fname = b:netrw_fname
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5667 sil keepj new
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5668 " call Decho("filter input window#".winnr())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5669
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5670 keepj put =g:netrw_ftpmode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5671 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5672
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5673 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5674 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5675 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5676 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5677
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5678 keepj call setline(line("$")+1,'lcd "'.fromdir.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5679 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5680
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5681 keepj call setline(line("$")+1,'cd "'.tgtdir.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5682 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5683
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5684 for fname in a:fname
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5685 keepj call setline(line("$")+1,'put "'.fname.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5686 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5687 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5688
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5689 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5690 " 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
5691 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
5692 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5693 " call Decho("filter input window#".winnr())
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5694 " 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
5695 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
5696 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5697 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5698 sil keepj g/Local directory now/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5699 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5700 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5701 call netrw#ErrorMsg(s:ERROR,getline(1),14)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5702 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5703 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5704 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5705
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5706 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5707 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5708 let netrw_fname= b:netrw_fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5709 call s:SaveBufVars()|silent keepjumps new|call s:RestoreBufVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5710 let tmpbufnr= bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5711 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5712
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5713 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5714 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5715 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5716 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5717 keepj put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5718 " call Decho("filter input: ".getline('$'))
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5721 if exists("g:netrw_ftp") && g:netrw_ftp == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5722 keepj put =g:netrw_uid
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5723 " call Decho("filter input: ".getline('$'))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5724 keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5725 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5726 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5727 keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5728 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5729 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5730
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5731 keepj call setline(line("$")+1,'lcd "'.fromdir.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5732 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5733
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5734 if exists("b:netrw_fname") && b:netrw_fname != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5735 keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5736 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5737 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5738
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5739 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5740 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5741 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5742 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5743
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5744 for fname in a:fname
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5745 keepj call setline(line("$")+1,'put "'.fname.'"')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5746 " call Decho("filter input: ".getline('$'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5747 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5748
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5749 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5750 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5751 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5752 " -n win32: quit being obnoxious about password
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5753 keepj norm! 1Gdd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5754 " call Decho("executing: ".s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5755 exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5756 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5757 sil keepj g/Local directory now/d
2034
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 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5760 let debugkeep= &debug
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5761 setlocal debug=msg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5762 call netrw#ErrorMsg(s:ERROR,getline(1),15)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5763 let &debug = debugkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5764 let mod = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5765 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5766 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5767 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5768 elseif !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5769 " call Dfunc("netrw#NetrwUpload : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5770 return
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5771 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5772 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5773 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
5774 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5775 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5776
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5777 " call Dret("s:NetrwUpload")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5778 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5779
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5780 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5781 " s:NetrwPreview: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5782 fun! s:NetrwPreview(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5783 " call Dfunc("NetrwPreview(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5784 call s:NetrwOptionSave("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5785 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5786 if has("quickfix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5787 if !isdirectory(a:path)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5788 if g:netrw_preview && !g:netrw_alto
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5789 let pvhkeep= &pvh
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5790 let &pvh = winwidth(0) - g:netrw_winsize
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5791 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5792 exe (g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5793 if exists("pvhkeep")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5794 let &pvh= pvhkeep
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5795 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5796 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5797 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
5798 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5799 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5800 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
5801 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5802 call s:NetrwOptionRestore("s:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5803 " call Dret("NetrwPreview")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5804 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5805
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5806 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5807 " s:NetrwRefresh: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5808 fun! s:NetrwRefresh(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5809 " 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
5810 " 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
5811 " 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
5812 " Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5813 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5814 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5815 " call Decho("clear buffer<".expand("%")."> with :%d")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
5816 sil! keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5817 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5818 call netrw#LocalBrowseCheck(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5819 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5820 call s:NetrwBrowse(a:islocal,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5821 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5822 call netrw#NetrwRestorePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5823
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5824 " restore file marks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5825 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5826 " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5827 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5828 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5829 " call Decho("2match none")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5830 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5831 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5832
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5833 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5834 " call Dret("NetrwRefresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5835 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5836
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5837 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5838 " s:NetrwRefreshDir: refreshes a directory by name {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5839 " Called by NetrwMarkFileCopy()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5840 " Interfaces to s:NetrwRefresh() and s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5841 fun! s:NetrwRefreshDir(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5842 " 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
5843 if g:netrw_fastbrowse == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5844 " slowest mode (keep buffers refreshed, local or remote)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5845 " call Decho("slowest mode: keep buffers refreshed, local or remote")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5846 let tgtwin= bufwinnr(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5847 " call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5848
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5849 if tgtwin > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5850 " tgtwin is being displayed, so refresh it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5851 let curwin= winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5852 " call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5853 exe tgtwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5854 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5855 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5856
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5857 elseif bufnr(a:dirname) > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5858 let bn= bufnr(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5859 " call Decho("bd bufnr(".a:dirname.")=".bn)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5860 exe "silent bd ".bn
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 elseif g:netrw_fastbrowse <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5864 " call Decho("medium-speed mode: refresh local buffers only")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5865 call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5866 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5867 " call Dret("s:NetrwRefreshDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5868 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5869
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5870 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5871 " 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
5872 " What this function does is to compute a priority for the patterns
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5873 " in the g:netrw_sort_sequence. It applies a substitute to any
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5874 " "files" that satisfy each pattern, putting the priority / in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5875 " front. An "*" pattern handles the default priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5876 fun! s:NetrwSetSort()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5877 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5878 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5879 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5880 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5881 let seqlist = g:netrw_sort_sequence
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5882 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5883 " sanity check -- insure that * appears somewhere
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5884 if seqlist == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5885 let seqlist= '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5886 elseif seqlist !~ '\*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5887 let seqlist= seqlist.',*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5888 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5889 let priority = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5890 while seqlist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5891 if seqlist =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5892 let seq = substitute(seqlist,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5893 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
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 let seq = seqlist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5896 let seqlist = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5897 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5898 if priority < 10
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5899 let spriority= "00".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5900 elseif priority < 100
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5901 let spriority= "0".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5902 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5903 let spriority= priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5904 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5905 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5906
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5907 " sanity check
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5908 if w:netrw_bannercnt > line("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5909 " apparently no files were left after a Hiding pattern was used
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5910 " call Dret("SetSort : no files left after hiding")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5911 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5912 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5913 if seq == '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5914 let starpriority= spriority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5915 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5916 exe 'sil keepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5917 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5918 " sometimes multiple sorting patterns will match the same file or directory.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5919 " The following substitute is intended to remove the excess matches.
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5920 exe 'sil keepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5921 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5922 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5923 let priority = priority + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5924 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5925 if exists("starpriority")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5926 exe 'sil keepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5927 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5928 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5929
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5930 " Following line associated with priority -- items that satisfy a priority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5931 " pattern get prefixed by ###/ which permits easy sorting by priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5932 " Sometimes files can satisfy multiple priority patterns -- only the latest
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5933 " priority pattern needs to be retained. So, at this point, these excess
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5934 " priority prefixes need to be removed, but not directories that happen to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5935 " be just digits themselves.
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5936 exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5937 call histdel("/",-1)
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 " call Dret("SetSort")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5940 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5941
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5942 " =====================================================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5943 " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5944 fun! s:NetrwSortStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5945 " 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
5946 call s:NetrwSaveWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5947 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5948
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5949 let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5950 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5951 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5952 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5953
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5954 " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5955 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5956
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5957 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5958 " s:NetrwSplit: mode {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5959 " =0 : net and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5960 " =1 : net and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5961 " =2 : net and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5962 " =3 : local and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5963 " =4 : local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5964 " =5 : local and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5965 fun! s:NetrwSplit(mode)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5966 " 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
5967
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5968 call s:SaveWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5969
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5970 if a:mode == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5971 " remote and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5972 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5973 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5974 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5975 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5976 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5977 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5978
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5979 elseif a:mode == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5980 " remote and t
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5981 let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5982 " call Decho("tabnew")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5983 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5984 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5985 call s:RestoreWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5986 call s:NetrwBrowse(0,newdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5987 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5988
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5989 elseif a:mode == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5990 " remote and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5991 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5992 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5993 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5994 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5995 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5996 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5997
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5998 elseif a:mode == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5999 " local and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6000 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6001 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6002 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6003 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6004 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6005 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6006
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6007 elseif a:mode == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6008 " local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6009 let cursorword = s:NetrwGetWord()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6010 let netrw_curdir= s:NetrwTreeDir()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6011 " call Decho("tabnew")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6012 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6013 let b:netrw_curdir= netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6014 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6015 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6016 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6017 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6018
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6019 elseif a:mode == 5
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6020 " local and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6021 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6022 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6023 let s:didsplit= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6024 call s:RestoreWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6025 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6026 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6027
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6028 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6029 call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6030 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6031
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6032 " call Dret("s:NetrwSplit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6033 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6034
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6035 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6036 " NetrwStatusLine: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6037 fun! NetrwStatusLine()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6038
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6039 " vvv NetrwStatusLine() debugging vvv
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6040 " let g:stlmsg=""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6041 " if !exists("w:netrw_explore_bufnr")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6042 " let g:stlmsg="!X<explore_bufnr>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6043 " elseif w:netrw_explore_bufnr != bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6044 " let g:stlmsg="explore_bufnr!=".bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6045 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6046 " if !exists("w:netrw_explore_line")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6047 " let g:stlmsg=" !X<explore_line>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6048 " elseif w:netrw_explore_line != line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6049 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6050 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6051 " if !exists("w:netrw_explore_list")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6052 " let g:stlmsg=" !X<explore_list>"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6053 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6054 " ^^^ NetrwStatusLine() debugging ^^^
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6055
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6056 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
6057 " restore user's status line
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6058 let &stl = s:netrw_users_stl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6059 let &laststatus = s:netrw_users_ls
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6060 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6061 if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6062 return ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6063 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6064 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6065 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6066 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6067
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6068 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6069 " s:NetrwTreeDir: determine tree directory given current cursor position {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6070 " (full path directory with trailing slash returned)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6071 fun! s:NetrwTreeDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6072 " 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
6073
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6074 let treedir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6075 " call Decho("set initial treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6076 let s:treecurpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6077
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6078 if w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6079 " call Decho("w:netrrw_liststyle is TREELIST:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6080 " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6081
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6082 " 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
6083 if getline('.') =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6084 let treedir= substitute(getline('.'),'^\%(| \)*\([^|].\{-}\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6085 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6086 let treedir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6087 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6088 " call Decho("treedir<".treedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6089
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6090 " detect user attempting to close treeroot
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6091 if getline('.') !~ '|' && getline('.') != '..'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6092 " call Decho("user attempted to close treeroot")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6093 " now force a refresh
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6094 " call Decho("clear buffer<".expand("%")."> with :%d")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6095 sil! keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6096 " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6097 return b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6098 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6099
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6100 " elide all non-depth information
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6101 let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6102 " call Decho("depth<".depth."> 1st subst (non-depth info removed)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6103
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6104 " elide first depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6105 let depth = substitute(depth,'^| ','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6106 " call Decho("depth<".depth."> 2nd subst (first depth removed)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6107
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6108 " construct treedir by searching backwards at correct depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6109 " call Decho("constructing treedir<".treedir."> depth<".depth.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6110 while depth != "" && search('^'.depth.'[^|].\{-}/$','bW')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6111 let dirname= substitute(getline('.'),'^\(| \)*','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6112 let treedir= dirname.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6113 let depth = substitute(depth,'^| ','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6114 " call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6115 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6116 if w:netrw_treetop =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6117 let treedir= w:netrw_treetop.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6118 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6119 let treedir= w:netrw_treetop.'/'.treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6120 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6121 " call Decho("bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6122 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6123 let treedir= substitute(treedir,'//$','/','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6124
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6125 " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6126 return treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6127 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6128
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6129 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6130 " s:NetrwTreeDisplay: recursive tree display {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6131 fun! s:NetrwTreeDisplay(dir,depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6132 " call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6133
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6134 " insure that there are no folds
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6135 setlocal nofen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6136
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6137 " install ../ and shortdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6138 if a:depth == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6139 call setline(line("$")+1,'../')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6140 " call Decho("setline#".line("$")." ../ (depth is zero)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6141 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6142 if a:dir =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6143 if a:dir == w:netrw_treetop
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6144 let shortdir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6145 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6146 let shortdir= substitute(a:dir,'^.*/\([^/]\+\)/$','\1/','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6147 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6148 call setline(line("$")+1,a:depth.shortdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6149 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6150 let shortdir= substitute(a:dir,'^.*/','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6151 call setline(line("$")+1,a:depth.shortdir.'/')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6152 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6153 " call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6154
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6155 " append a / to dir if its missing one
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6156 let dir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6157 if dir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6158 let dir= dir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6159 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6160
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6161 " display subtrees (if any)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6162 let depth= "| ".a:depth
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6163
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6164 " call Decho("display subtrees with depth<".depth."> and current leaves")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6165 for entry in w:netrw_treedict[a:dir]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6166 let direntry= substitute(dir.entry,'/$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6167 " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6168 if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6169 " call Decho("<".direntry."> is a key in treedict - display subtree for it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6170 call s:NetrwTreeDisplay(direntry,depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6171 elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6172 " call Decho("<".direntry."/> is a key in treedict - display subtree for it")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6173 call s:NetrwTreeDisplay(direntry.'/',depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6174 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6175 " call Decho("<".entry."> is not a key in treedict (no subtree)")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6176 sil! keepj call setline(line("$")+1,depth.entry)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6177 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6178 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6179 " call Dret("NetrwTreeDisplay")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6180 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6181
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6182 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6183 " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6184 fun! s:NetrwTreeListing(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6185 if w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6186 " call Dfunc("NetrwTreeListing() bufname<".expand("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6187 " call Decho("curdir<".a:dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6188 " 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
6189
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6190 " update the treetop
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6191 " call Decho("update the treetop")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6192 if !exists("w:netrw_treetop")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6193 let w:netrw_treetop= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6194 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6195 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
6196 let w:netrw_treetop= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6197 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6198 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6199
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6200 " insure that we have at least an empty treedict
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6201 if !exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6202 let w:netrw_treedict= {}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6203 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6204
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6205 " update the directory listing for the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6206 " call Decho("updating dictionary with ".a:dirname.":[..directory listing..]")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6207 " call Decho("bannercnt=".w:netrw_bannercnt." line($)=".line("$"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6208 exe "sil! keepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6209 let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6210 " call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6211 exe "sil! keepj ".w:netrw_bannercnt.",$d"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6212
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6213 " if past banner, record word
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6214 if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6215 let fname= expand("<cword>")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6216 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6217 let fname= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6218 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6219 " call Decho("fname<".fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6220
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6221 " display from treetop on down
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6222 call s:NetrwTreeDisplay(w:netrw_treetop,"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6223
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6224 " call Dret("NetrwTreeListing : bufname<".expand("%").">")
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 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6227
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6228 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6229 " s:NetrwWideListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6230 fun! s:NetrwWideListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6231
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6232 if w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6233 " 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
6234 " look for longest filename (cpf=characters per filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6235 " cpf: characters per filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6236 " fpl: filenames per line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6237 " fpc: filenames per column
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6238 setlocal ma noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6239 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6240 let b:netrw_cpf= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6241 if line("$") >= w:netrw_bannercnt
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6242 exe 'sil keepj '.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
6243 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6244 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6245 " call Dret("NetrwWideListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6246 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6247 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6248 let b:netrw_cpf= b:netrw_cpf + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6249 " call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6251 " determine qty files per line (fpl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6252 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6253 if w:netrw_fpl <= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6254 let w:netrw_fpl= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6255 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6256 " 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
6257
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6258 " make wide display
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6259 exe 'sil keepj '.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
6260 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6261 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6262 let newcolstart = w:netrw_bannercnt + fpc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6263 let newcolend = newcolstart + fpc - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6264 " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6265 sil! let keepregstar = @*
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6266 while line("$") >= newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6267 if newcolend > line("$") | let newcolend= line("$") | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6268 let newcolqty= newcolend - newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6269 exe newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6270 if newcolqty == 0
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6271 exe "sil! keepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6272 else
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6273 exe "sil! keepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6274 endif
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6275 exe "sil! keepj ".newcolstart.','.newcolend.'d'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6276 exe 'sil! keepj '.w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6277 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6278 silent! let @*= keepregstar
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6279 exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6280 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6281 setlocal noma nomod ro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6282 " call Dret("NetrwWideListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6283 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6284
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6285 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6286
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6287 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6288 " s:PerformListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6289 fun! s:PerformListing(islocal)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6290 " call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6291
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6292 call s:NetrwSafeOptions()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6293 setlocal noro ma
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6294 " call Decho("setlocal noro ma")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6295
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6296 " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6297 " call Decho("(netrw) Processing your browsing request...")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6298 " endif " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6299
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6300 " 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
6301 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
6302 " force a refresh for tree listings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6303 " call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6304 sil! keepj %d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6305 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6306
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6307 " save current directory on directory history list
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6308 call s:NetrwBookHistHandler(3,b:netrw_curdir)
1621
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 up the banner {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6311 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6312 " call Decho("set up banner")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6313 keepj put ='\" ============================================================================'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6314 keepj put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6315 keepj put ='\" '.b:netrw_curdir
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6316 keepj 1d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6317 let w:netrw_bannercnt= 3
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6318 exe "sil! keepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6319 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6320 keepj 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6321 let w:netrw_bannercnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6322 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6323
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6324 let sortby= g:netrw_sort_by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6325 if g:netrw_sort_direction =~ "^r"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6326 let sortby= sortby." reversed"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6327 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6328
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6329 " Sorted by... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6330 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6331 " 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
6332 if g:netrw_sort_by =~ "^n"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6333 " call Decho("directories will be sorted by name")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6334 " sorted by name
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6335 keepj put ='\" Sorted by '.sortby
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6336 keepj put ='\" Sort sequence: '.g:netrw_sort_sequence
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6337 let w:netrw_bannercnt= w:netrw_bannercnt + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6338 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6339 " call Decho("directories will be sorted by size or time")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6340 " sorted by size or date
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6341 keepj put ='\" Sorted by '.sortby
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6342 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6343 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6344 exe "sil! keepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6345 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6346
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6347 " show copy/move target, if any
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6348 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6349 if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6350 " call Decho("show copy/move target<".s:netrwmftgt.">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6351 keepj put =''
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6352 if s:netrwmftgt_islocal
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6353 sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6354 else
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6355 sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6356 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6357 let w:netrw_bannercnt= w:netrw_bannercnt + 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6358 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6359 " 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
6360 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6361 exe "sil! keepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6362 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6363
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6364 " Hiding... -or- Showing... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6365 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6366 " 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
6367 if g:netrw_list_hide != "" && g:netrw_hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6368 if g:netrw_hide == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6369 keepj put ='\" Hiding: '.g:netrw_list_hide
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6370 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6371 keepj put ='\" Showing: '.g:netrw_list_hide
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6372 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6373 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6374 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6375 exe "keepjumps ".w:netrw_bannercnt
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6376 keepj put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6377 keepj put ='\" ============================================================================'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6378 let w:netrw_bannercnt= w:netrw_bannercnt + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6379 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6380
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6381 " bannercnt should index the line just after the banner
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6382 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6383 let w:netrw_bannercnt= w:netrw_bannercnt + 1
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6384 exe "sil! keepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6385 " 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
6386 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6387
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6388 " set up syntax highlighting {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6389 " call Decho("set up syntax highlighting")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6390 if has("syntax")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6391 setf netrw
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6392 if !exists("g:syntax_on") || !g:syntax_on
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6393 setlocal ft=
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 " get list of files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6398 " call Decho("Get list of files - islocal=".a:islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6399 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6400 call s:LocalListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6401 else " remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6402 call s:NetrwRemoteListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6403 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6404 " 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
6405
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6406 " manipulate the directory listing (hide, sort) {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6407 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6408 " call Decho("manipulate directory listing (hide)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6409 " 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
6410 if g:netrw_hide && g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6411 call s:NetrwListHide()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6412 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6413 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6414 " 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
6415
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6416 if g:netrw_sort_by =~ "^n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6417 " sort by name
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6418 call s:NetrwSetSort()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6419
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6420 if !g:netrw_banner || w:netrw_bannercnt < line("$")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6421 " 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
6422 if g:netrw_sort_direction =~ 'n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6423 " normal direction sorting
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6424 exe 'sil keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6425 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6426 " reverse direction sorting
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6427 exe 'sil keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6428 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6429 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6430 " remove priority pattern prefix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6431 " call Decho("remove priority pattern prefix")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6432 exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6433 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6434
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6435 elseif a:islocal
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6436 if !g:netrw_banner || w:netrw_bannercnt < line("$")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6437 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6438 if g:netrw_sort_direction =~ 'n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6439 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort')
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6440 exe 'sil! keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6441 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6442 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!')
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6443 exe 'sil! keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6444 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6445 exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6446 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6447 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6448 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6449
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6450 elseif g:netrw_sort_direction =~ 'r'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6451 " call Decho('reverse the sorted listing')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6452 if !g:netrw_banner || w:netrw_bannercnt < line('$')
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6453 exe 'sil! keepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6454 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6455 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6456 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6457 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6458
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6459 " convert to wide/tree listing {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6460 " call Decho("modify display if wide/tree listing style")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6461 call s:NetrwWideListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6462 call s:NetrwTreeListing(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6463
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6464 if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6465 " place cursor on the top-left corner of the file listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6466 " call Decho("place cursor on top-left corner of file listing")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6467 exe 'sil! keepj '.w:netrw_bannercnt
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6468 sil! keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6469 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6470
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6471 " record previous current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6472 let w:netrw_prvdir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6473 " call Decho("record netrw_prvdir<".w:netrw_prvdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6474
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6475 " save certain window-oriented variables into buffer-oriented variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6476 call s:SetBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6477 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6478
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6479 " set display to netrw display settings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6480 " call Decho("set display to netrw display settings (noma nomod etc)")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6481 exe "setl ".g:netrw_bufsettings
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6482 if exists("s:treecurpos")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6483
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6484 call netrw#NetrwRestorePosn(s:treecurpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6485 unlet s:treecurpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6486 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6487
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6488 " call Dret("s:PerformListing : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6489 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6490
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6491 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6492 " s:SetupNetrwStatusLine: {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6493 fun! s:SetupNetrwStatusLine(statline)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6494 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6495
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6496 if !exists("s:netrw_setup_statline")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6497 let s:netrw_setup_statline= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6498 " call Decho("do first-time status line setup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6499
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6500 if !exists("s:netrw_users_stl")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6501 let s:netrw_users_stl= &stl
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6502 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6503 if !exists("s:netrw_users_ls")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6504 let s:netrw_users_ls= &laststatus
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6505 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6506
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6507 " set up User9 highlighting as needed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6508 let keepa= @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6509 redir @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6510 try
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6511 hi User9
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6512 catch /^Vim\%((\a\+)\)\=:E411/
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6513 if &bg == "dark"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6514 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6515 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6516 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6517 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6518 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6519 redir END
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6520 let @a= keepa
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6521 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6522
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6523 " set up status line (may use User9 highlighting)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6524 " insure that windows have a statusline
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6525 " make sure statusline is displayed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6526 let &stl=a:statline
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6527 setlocal laststatus=2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6528 " call Decho("stl=".&stl)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6529 redraw
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6530
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6531 " call Dret("SetupNetrwStatusLine : stl=".&stl)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6532 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6533
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6534 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6535 " Remote Directory Browsing Support: {{{1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6536 " ===========================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6537
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6538 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6539 " s:NetrwRemoteListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6540 fun! s:NetrwRemoteListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6541 " call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6542
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6543 call s:RemotePathAnalysis(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6544
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6545 " sanity check:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6546 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6547 " call Decho("b:netrw_method=".b:netrw_method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6548 if !executable("ftp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6549 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6550 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
6551 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6552 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6553 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6554 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6555 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6556
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6557 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6558 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6559 if g:netrw_list_cmd == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6560 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
6561 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6562 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
6563 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6564 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6565
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6566 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6567 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6568 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6569 endif " (remote handling sanity check)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6570
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6571 if exists("b:netrw_method")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6572 " call Decho("setting w:netrw_method<".b:netrw_method.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6573 let w:netrw_method= b:netrw_method
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6574 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6575
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6576 if s:method == "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6577 " use ftp to get remote file listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6578 " call Decho("use ftp to get remote file listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6579 let s:method = "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6580 let listcmd = g:netrw_ftp_list_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6581 if g:netrw_sort_by =~ '^t'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6582 let listcmd= g:netrw_ftp_timelist_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6583 elseif g:netrw_sort_by =~ '^s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6584 let listcmd= g:netrw_ftp_sizelist_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6585 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6586 " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6587 call s:NetrwRemoteFtpCmd(s:path,listcmd)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6588 " exe "sil! keepalt keepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6589
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6590 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
6591 " shorten the listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6592 " call Decho("generate short listing")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6593 exe "sil! keepalt keepj ".w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6594
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6595 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6596 if g:netrw_ftp_browse_reject != ""
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6597 exe "sil! keepalt keepj g/".g:netrw_ftp_browse_reject."/keepj d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6598 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6599 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6600 sil! keepj %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6601 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6602
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6603 " if there's no ../ listed, then put ./ and ../ in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6604 let line1= line(".")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6605 exe "sil! keepj ".w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6606 let line2= search('^\.\.\/\%(\s\|$\)','cnW')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6607 if line2 == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6608 " call Decho("netrw is putting ./ and ../ into listing")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6609 sil! keepj put='../'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6610 sil! keepj put='./'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6611 endif
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6612 exe "sil! keepj ".line1
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6613 sil! keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6614
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6615 " call Decho("line1=".line1." line2=".line2." line(.)=".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6616 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
6617 " call Decho("M$ ftp cleanup")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6618 exe 'sil! keepj '.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
6619 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6620 else " normal ftp cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6621 " call Decho("normal ftp cleanup")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6622 exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6623 exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6624 exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6625 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6626 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6627 call histdel("/",-1)
1621
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 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6630
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6631 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6632 " use ssh to get remote file listing {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6633 " call Decho("use ssh to get remote file listing: s:path<".s:path.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6634 let listcmd= s:MakeSshCmd(g:netrw_list_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6635 " call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6636 if g:netrw_scp_cmd =~ '^pscp'
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6637 " call Decho("1: exe silent r! ".shellescape(listcmd.s:path, 1))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6638 exe "sil! keepj r! ".listcmd.shellescape(s:path, 1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6639 " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6640 sil! keepj g/^Listing directory/keepj d
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6641 sil! keepj g/^d[-rwx][-rwx][-rwx]/keepj s+$+/+e
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6642 sil! keepj g/^l[-rwx][-rwx][-rwx]/keepj s+$+@+e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6643 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6644 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6645 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6646 if g:netrw_liststyle != s:LONGLIST
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6647 sil! keepj g/^[dlsp-][-rwx][-rwx][-rwx]/keepj s/^.*\s\(\S\+\)$/\1/e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6648 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6649 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6650 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6651 if s:path == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6652 " call Decho("2: exe silent r! ".listcmd)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6653 exe "sil! keepalt r! ".listcmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6654 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6655 " call Decho("3: exe silent r! ".listcmd.' '.shellescape(s:path,1))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6656 exe "sil! keepalt r! ".listcmd.' '.shellescape(s:path,1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6657 " call Decho("listcmd<".listcmd."> path<".s:path.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6658 endif
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 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6662 if g:netrw_ftp_browse_reject != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6663 " call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6664 exe "sil! g/".g:netrw_ssh_browse_reject."/keepj d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6665 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6666 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6667 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6668
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6669 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6670 " 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
6671 " call Decho("fix long listing:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6672
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6673 if s:method == "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6674 " cleanup
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6675 exe "sil! keepj ".w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6676 while getline('.') =~ g:netrw_ftp_browse_reject
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6677 sil! keepj d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6678 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6679 " if there's no ../ listed, then put ./ and ../ in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6680 let line1= line(".")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6681 sil! keepj 1
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6682 sil! keepj call search('^\.\.\/\%(\s\|$\)','W')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6683 let line2= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6684 if line2 == 0
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6685 exe 'sil! keepj '.w:netrw_bannercnt."put='./'"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6686 if b:netrw_curdir != '/'
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6687 exe 'sil! keepj '.w:netrw_bannercnt."put='../'"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6688 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6689 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6690 exe "sil! keepj ".line1
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6691 sil! keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6692 endif
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 search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6695 " call Decho("M$ ftp site listing cleanup")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6696 exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6697 elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6698 " call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6699 exe 'sil keepj '.w:netrw_bannercnt.',$s/ -> .*$//e'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6700 exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6701 exe 'sil keepj '.w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6702 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6703 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6704 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6705 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6706 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6707
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6708 " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6709 " exe "keepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6710 " endif " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6711 " call Dret("s:NetrwRemoteListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6712 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6713
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6714 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6715 " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6716 fun! s:NetrwRemoteRm(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6717 " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6718 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6719 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6720
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6721 let all= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6722 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6723 " remove all marked files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6724 " call Decho("remove all marked files with bufnr#".bufnr("%"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6725 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6726 let ok= s:NetrwRemoteRmFile(a:path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6727 if ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6728 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6729 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6730 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6731 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6732 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6733 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6734
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6735 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6736 " remove files specified by range
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6737 " call Decho("remove files specified by range")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6738
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6739 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6740 let ctr= a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6741
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6742 " remove multiple files and directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6743 while ctr <= a:lastline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6744 exe ctr
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6745 let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6746 if ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6747 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6748 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6749 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6750 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6751 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6752 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6753 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6754
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6755 " refresh the (remote) directory listing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6756 " call Decho("refresh remote directory listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6757 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6758 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6759
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6760 " call Dret("s:NetrwRemoteRm")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6761 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6762
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6763 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6764 " s:NetrwRemoteRmFile: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6765 fun! s:NetrwRemoteRmFile(path,rmfile,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6766 " call Dfunc("s:NetrwRemoteRmFile(path<".a:path."> rmfile<".a:rmfile.">) all=".a:all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6767
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6768 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6769 let ok = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6770
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6771 if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6772 " attempt to remove file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6773 " call Decho("attempt to remove file (all=".all.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6774 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6775 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6776 " call Decho("case all=0:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6777 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6778 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
6779 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6780 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6781 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6782 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6783 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6784 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
6785 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6786 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6787 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6788 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6789
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6790 if all || ok =~ 'y\%[es]' || ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6791 " 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
6792 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6793 " call Decho("case ftp:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6794 let path= a:path
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6795 if path =~ '^\a\+://'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6796 let path= substitute(path,'^\a\+://[^/]\+/','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6797 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6798 sil! keepj .,$d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6799 call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6800 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6801 " call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6802 let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6803 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6804 if !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6805 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
6806 let ok="q"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6807 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6808 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6809 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6810 " call Decho("remotedir<".remotedir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6811 " call Decho("rmfile<".a:rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6812 if remotedir != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6813 let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(remotedir.a:rmfile))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6814 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6815 let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(a:rmfile))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6816 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6817 " call Decho("call system(".netrw_rm_cmd.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6818 let ret= system(netrw_rm_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6819 if ret != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6820 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6821 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6822 " call Decho("returned=".ret." errcode=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6823 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6824 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6825 elseif ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6826 " call Decho("ok==".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6827 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6828 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6829
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6830 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6831 " attempt to remove directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6832 " call Decho("attempt to remove directory")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6833 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6834 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6835 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
6836 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6837 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6838 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6839 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6840 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
6841 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6842 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6843 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6844 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6845
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6846 if all || ok =~ 'y\%[es]' || ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6847 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6848 call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6849 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6850 let rmfile = substitute(a:path.a:rmfile,'/$','','')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6851 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
6852 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6853 let ret= system(netrw_rmdir_cmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6854 " call Decho("returned=".ret." errcode=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6855
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6856 if v:shell_error != 0
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6857 " call Decho("v:shell_error not 0")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6858 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
6859 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6860 let ret= system(netrw_rmf_cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6861 " call Decho("returned=".ret." errcode=".v:shell_error)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6862
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6863 if v:shell_error != 0 && !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6864 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
6865 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6866 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6867 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6868
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6869 elseif ok =~ 'q\%[uit]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6870 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6871 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6872 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6873
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6874 " call Dret("s:NetrwRemoteRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6875 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6876 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6877
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6878 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6879 " s:NetrwRemoteFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6880 " This function assumes that a long listing will be received. Size, time,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6881 " and reverse sorts will be requested of the server but not otherwise
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6882 " enforced here.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6883 fun! s:NetrwRemoteFtpCmd(path,listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6884 " 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
6885 " call Decho("line($)=".line("$")." bannercnt=".w:netrw_bannercnt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6886
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6887 " because WinXX ftp uses unix style input
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6888 let ffkeep= &ff
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6889 setlocal ma ff=unix noro
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6890 " call Decho("setlocal ma ff=unix noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6891
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6892 " clear off any older non-banner lines
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6893 " note that w:netrw_bannercnt indexes the line after the banner
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6894 " 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
6895 exe "silent! keepjumps ".w:netrw_bannercnt.",$d"
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 if w:netrw_method == 2 || w:netrw_method == 5
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6899 " ftp + <.netrc>: Method #2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6900 if a:path != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6901 keepj put ='cd \"'.a:path.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6902 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6903 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6904 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6905 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6906 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6907 call setline(line("$")+1,a:listcmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6908 " exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6909 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6910 " 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
6911 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
6912 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6913 " 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
6914 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
6915 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6916
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6917 ".........................................
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6918 elseif w:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6919 " ftp + machine,id,passwd,filename: Method #3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6920 setlocal ff=unix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6921 if exists("g:netrw_port") && g:netrw_port != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6922 keepj put ='open '.g:netrw_machine.' '.g:netrw_port
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6923 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6924 keepj put ='open '.g:netrw_machine
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6925 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6926
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6927 if exists("g:netrw_ftp") && g:netrw_ftp == 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6928 keepj put =g:netrw_uid
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6929 keepj put ='\"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6930 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6931 keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6932 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 if a:path != ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6935 keepj put ='cd \"'.a:path.'\"'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6936 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6937 if exists("g:netrw_ftpextracmd")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6938 keepj put =g:netrw_ftpextracmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6939 " call Decho("filter input: ".getline('.'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6940 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6941 keepj call setline(line("$")+1,a:listcmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6942
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6943 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6944 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6945 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6946 " -n win32: quit being obnoxious about password
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6947 " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6948 " 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
6949 exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".g:netrw_ftp_cmd." -i -n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6950
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6951 ".........................................
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6952 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6953 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",23)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6954 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6955
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6956 " cleanup for Windows
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6957 if has("win32") || has("win95") || has("win64") || has("win16")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6958 sil! keepj %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6959 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6960 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6961 if a:listcmd == "dir"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6962 " infer directory/link based on the file permission string
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6963 sil! keepj g/d\%([-r][-w][-x]\)\{3}/keepj s@$@/@
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6964 sil! keepj g/l\%([-r][-w][-x]\)\{3}/keepj s/$/@/
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6965 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6966 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6967 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6968 exe "sil! keepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
6969 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6970 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6971 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6972
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6973 " ftp's listing doesn't seem to include ./ or ../
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6974 if !search('^\.\/$\|\s\.\/$','wn')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6975 exe 'keepj '.w:netrw_bannercnt
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6976 keepj put ='./'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6977 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6978 if !search('^\.\.\/$\|\s\.\.\/$','wn')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6979 exe 'keepj '.w:netrw_bannercnt
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
6980 keepj put ='../'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6981 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6982
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6983 " restore settings
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6984 let &ff= ffkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6985 " call Dret("NetrwRemoteFtpCmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6986 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6987
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6988 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6989 " s:NetrwRemoteRename: rename a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6990 fun! s:NetrwRemoteRename(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6991 " call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6992
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6993 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6994 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6995 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6996 let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6997
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6998 " rename files given by the markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6999 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7000 for oldname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7001 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7002 if exists("subfrom")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7003 let newname= substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7004 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7005 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7006 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7007 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7008 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7009 if newname =~ '^s/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7010 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7011 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7012 let newname = substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7013 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7014 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7015 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7016
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7017 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7018 call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7019 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7020 let oldname= shellescape(a:path.oldname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7021 let newname= shellescape(a:path.newname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7022 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7023 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7024 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7025
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7026 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7027 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7028
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7029 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7030
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7031 " attempt to rename files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7032 while ctr <= a:lastline
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7033 exe "keepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7034
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7035 let oldname= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7036 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7037
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7038 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7039 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7040 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7041
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7042 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7043 call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7044 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7045 let oldname= shellescape(a:path.oldname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7046 let newname= shellescape(a:path.newname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7047 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7048 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7049 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7050
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7051 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7052 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7053 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7054
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7055 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7056 call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7057 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7058
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7059 " call Dret("NetrwRemoteRename")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7060 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7061
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7062 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7063 " Local Directory Browsing Support: {{{1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7064 " ==========================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7065
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7066 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7067 " netrw#LocalBrowseCheck: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7068 fun! netrw#LocalBrowseCheck(dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7069 " unfortunate interaction -- split window debugging can't be
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7070 " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7071 " event triggers another call to LocalBrowseCheck() when attempts
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7072 " to write to the DBG buffer are made.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7073 " The &ft == "netrw" test was installed because the BufEnter event
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7074 " would hit when re-entering netrw windows, creating unexpected
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7075 " 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
7076 " 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
7077 if isdirectory(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7078 " 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
7079 if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7080 silent! call s:NetrwBrowse(1,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7081 elseif &ft == "netrw" && line("$") == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7082 silent! call s:NetrwBrowse(1,a:dirname)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7083 elseif exists("s:treeforceredraw")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7084 unlet s:treeforceredraw
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7085 silent! call s:NetrwBrowse(1,a:dirname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7086 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7087 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7088 " not a directory, ignore it
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7089 endfun
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7090
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7091 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7092 " s:LocalListing: does the job of "ls" for local directories {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7093 fun! s:LocalListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7094 " call Dfunc("s:LocalListing()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7095 " call Decho("&ma=".&ma)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7096 " call Decho("&mod=".&mod)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7097 " call Decho("&ro=".&ro)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7098 " call Decho("bufname(%)<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7099
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7100 " 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
7101 " 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
7102
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7103 " get the list of files contained in the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7104 let dirname = escape(b:netrw_curdir,g:netrw_glob_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7105 let dirnamelen = s:Strlen(b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7106 let filelist = glob(s:ComposePath(dirname,"*"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7107 " call Decho("glob(dirname<".dirname."/*>)=".filelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7108 if filelist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7109 let filelist= filelist."\n"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7110 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7111 let filelist= filelist.glob(s:ComposePath(dirname,".*"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7112 " call Decho("glob(dirname<".dirname."/.*>)=".filelist)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7113
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7114 " Coding choice: either elide ./ if present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7115 " or include ./ if not present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7116 if filelist =~ '[\\/]\.[\\/]\=\(\n\|$\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7117 " elide /path/. from glob() entries if present
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7118 " call Decho("elide /path/. from glob entries if present")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7119 let filelist = substitute(filelist,'\n','\t','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7120 let filelist = substitute(filelist,'^[^\t]\+[/\\]\.\t','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7121 let filelist = substitute(filelist,'[^\t]\+[/\\]\.$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7122 let filelist = substitute(filelist,'\t\zs[^\t]\+[/\\]\.\t','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7123 let filelist = substitute(filelist,'\t','\n','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7124 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7125 " call Decho("filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7126 if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7127 " include ../ in the glob() entry if its missing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7128 " call Decho("forcibly tacking on ..")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7129 let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7130 " call Decho("filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7131 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7132 if b:netrw_curdir == '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7133 " remove .. from filelist when current directory is root directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7134 " call Decho("remove .. from filelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7135 let filelist= substitute(filelist,'/\.\.\n','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7136 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7137 " remove multiple contiguous newlines
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7138 let filelist= substitute(filelist,'\n\{2,}','\n','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7139 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7140 " change all \s to /s
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7141 " call Decho('change all \s to /s')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7142 let filelist= substitute(filelist,'\','/','g')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7143 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7144 " escape all \s to \\
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7145 " call Decho('escape all \s to \\')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7146 let filelist= substitute(filelist,'\','\\','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7147 endif
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 Decho("(before while) dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7150 " call Decho("(before while) dirnamelen<".dirnamelen.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7151 " call Decho("(before while) filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7152
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7153 while filelist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7154 if filelist =~ '\n'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7155 let filename = substitute(filelist,'\n.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7156 let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7157 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7158 let filename = filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7159 let filelist = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7160 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7161 " call Decho(" ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7162 " call Decho("(while) filelist<".filelist.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7163 " call Decho("(while) filename<".filename.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7164
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7165 if getftype(filename) == "link"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7166 " indicate a symbolic link
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7167 " call Decho("indicate <".filename."> is a symbolic link with trailing @")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7168 let pfile= filename."@"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7169
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7170 elseif getftype(filename) == "socket"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7171 " indicate a socket
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7172 " call Decho("indicate <".filename."> is a socket with trailing =")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7173 let pfile= filename."="
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7174
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7175 elseif getftype(filename) == "fifo"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7176 " indicate a fifo
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7177 " call Decho("indicate <".filename."> is a fifo with trailing |")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7178 let pfile= filename."|"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7179
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7180 elseif isdirectory(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7181 " indicate a directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7182 " call Decho("indicate <".filename."> is a directory with trailing /")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7183 let pfile= filename."/"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7184
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7185 elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7186 if (has("win32") || has("win95") || has("win64") || has("win16"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7187 if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7188 " indicate an executable
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7189 " call Decho("indicate <".filename."> is executable with trailing *")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7190 let pfile= filename."*"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7191 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7192 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7193 let pfile= filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7194 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7195 elseif executable(filename)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7196 " indicate an executable
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7197 " call Decho("indicate <".filename."> is executable with trailing *")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7198 let pfile= filename."*"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7199 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7200 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7201 let pfile= filename
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 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7205 " normal file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7206 let pfile= filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7207 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7208 " call Decho("pfile<".pfile."> (after *@/ appending)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7209
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7210 if pfile =~ '//$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7211 let pfile= substitute(pfile,'//$','/','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7212 " call Decho("change // to /: pfile<".pfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7213 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7214 let pfile= strpart(pfile,dirnamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7215 let pfile= substitute(pfile,'^[/\\]','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7216 " call Decho("filename<".filename.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7217 " call Decho("pfile <".pfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7218
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7219 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7220 let sz = getfsize(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7221 let fsz = strpart(" ",1,15-strlen(sz)).sz
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7222 let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7223 " call Decho("sz=".sz." fsz=".fsz)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7224 endif
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 g:netrw_sort_by =~ "^t"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7227 " sort by time (handles time up to 1 quintillion seconds, US)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7228 " call Decho("getftime(".filename.")=".getftime(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7229 let t = getftime(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7230 let ft = strpart("000000000000000000",1,18-strlen(t)).t
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7231 " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7232 let ftpfile= ft.'/'.pfile
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7233 sil! keepj put=ftpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7234
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7235 elseif g:netrw_sort_by =~ "^s"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7236 " sort by size (handles file sizes up to 1 quintillion bytes, US)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7237 " call Decho("getfsize(".filename.")=".getfsize(filename))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7238 let sz = getfsize(filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7239 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7240 " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7241 let fszpfile= fsz.'/'.pfile
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7242 sil! keepj put =fszpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7243
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7244 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7245 " sort by name
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7246 " call Decho("exe keepjumps put ='".pfile."'")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7247 sil! keepj put=pfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7248 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7249 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7251 " cleanup any windows mess at end-of-line
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7252 sil! keepj g/^$/d
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7253 sil! keepj %s/\r$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7254 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7255 exe "setlocal ts=".g:netrw_maxfilenamelen
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7256 " call Decho("setlocal ts=".g:netrw_maxfilenamelen)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7257
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7258 " call Dret("s:LocalListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7259 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7260
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7261 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7262 " s:LocalBrowseShellCmdRefresh: this function is called after a user has {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7263 " performed any shell command. The idea is to cause all local-browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7264 " buffers to be refreshed after a user has executed some shell command,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7265 " on the chance that s/he removed/created a file/directory with it.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7266 fun! s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7267 " 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
7268 " determine which buffers currently reside in a tab
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7269 if !exists("s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7270 " call Dret("LocalBrowseShellCmdRefresh : browselist is empty")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7271 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7272 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7273 if !exists("w:netrw_bannercnt")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7274 " call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw window")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7275 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7276 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7277 if exists("s:locbrowseshellcmd")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7278 if s:locbrowseshellcmd
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7279 let s:locbrowseshellcmd= 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7280 " call Dret("LocalBrowseShellCmdRefresh : NetrwBrowse itself caused the refresh")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7281 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7282 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7283 let s:locbrowseshellcmd= 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7284 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7285 let itab = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7286 let buftablist = []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7287 while itab <= tabpagenr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7288 let buftablist = buftablist + tabpagebuflist()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7289 let itab = itab + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7290 tabn
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7291 endwhile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7292 " call Decho("buftablist".string(buftablist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7293 " call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7294 " GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7295 " | refresh any netrw window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7296 " | wipe out any non-displaying netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7297 let curwin = winnr()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7298 let ibl = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7299 for ibuf in s:netrw_browselist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7300 " call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7301 if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7302 " wipe out any non-displaying netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7303 " call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7304 exe "sil! bd ".fnameescape(ibuf)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7305 call remove(s:netrw_browselist,ibl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7306 " call Decho("browselist=".string(s:netrw_browselist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7307 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7308 elseif index(tabpagebuflist(),ibuf) != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7309 " refresh any netrw buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7310 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7311 exe bufwinnr(ibuf)."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7312 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7313 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7314 let ibl= ibl + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7315 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7316 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7317
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7318 " call Dret("LocalBrowseShellCmdRefresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7319 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7320
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7321 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7322 " s:NetrwLocalRm: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7323 fun! s:NetrwLocalRm(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7324 " call Dfunc("s:NetrwLocalRm(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7325 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7326
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7327 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7328 let ret = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7329 let all = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7330 let svpos = netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7331
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7332 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7333 " remove all marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7334 " call Decho("remove all marked files")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7335 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7336 let ok= s:NetrwLocalRmFile(a:path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7337 if ok =~ 'q\%[uit]' || ok == "no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7338 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7339 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7340 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7341 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7342 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7343 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7344
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7345 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7346 " remove (multiple) files and directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7347 " call Decho("remove files in range [".a:firstline.",".a:lastline."]")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7348
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7349 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7350 while ctr <= a:lastline
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7351 exe "keepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7352
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7353 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7354 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7355 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7356 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7357 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7358 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7359 if curword == "./" || curword == "../"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7360 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7361 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7362 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7363 let ok= s:NetrwLocalRmFile(a:path,curword,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7364 if ok =~ 'q\%[uit]' || ok == "no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7365 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7366 elseif ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7367 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7368 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7369 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7370 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7371 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7372
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7373 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7374 " call Decho("bufname<".bufname("%").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7375 if bufname("%") != "NetrwMessage"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7376 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7377 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7378 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7379
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7380 " call Dret("s:NetrwLocalRm")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7381 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7382
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7383 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7384 " s:NetrwLocalRmFile: remove file fname given the path {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7385 " Give confirmation prompt unless all==1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7386 fun! s:NetrwLocalRmFile(path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7387 " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7388
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7389 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7390 let ok = ""
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7391 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7392 let rmfile= s:ComposePath(a:path,a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7393 " call Decho("rmfile<".rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7394
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7395 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7396 " attempt to remove file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7397 " call Decho("attempt to remove file<".rmfile.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7398 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7399 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7400 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7401 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
7402 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7403 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7404 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7405 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7406 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7407 " call Decho("response: ok<".ok.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7408 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
7409 " call Decho("response: ok<".ok."> (after sub)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7410 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7411 let all= 1
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 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7414
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7415 if all || ok =~ 'y\%[es]' || ok == ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7416 let ret= s:NetrwDelete(rmfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7417 " call Decho("errcode=".v:shell_error." ret=".ret)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7418 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7419
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7420 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7421 " attempt to remove directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7422 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7423 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7424 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7425 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
7426 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7427 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
7428 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7429 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7430 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7431 if ok =~ 'a\%[ll]'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7432 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7433 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7434 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7435 let rmfile= substitute(rmfile,'[\/]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7436
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7437 if all || ok =~ 'y\%[es]' || ok == ""
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7438 " 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
7439 call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7440 " call Decho("v:shell_error=".v:shell_error)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7441
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7442 if v:shell_error != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7443 " call Decho("2nd attempt to remove directory<".rmfile.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7444 let errcode= s:NetrwDelete(rmfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7445 " call Decho("errcode=".errcode)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7446
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7447 if errcode != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7448 if has("unix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7449 " call Decho("3rd attempt to remove directory<".rmfile.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7450 call system("rm ".shellescape(rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7451 if v:shell_error != 0 && !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7452 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
7453 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7454 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7455 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7456 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
7457 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7458 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7459 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7460 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7461 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7462 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7463
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7464 " call Dret("s:NetrwLocalRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7465 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7466 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7467
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7468 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7469 " s:NetrwLocalRename: rename a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7470 fun! s:NetrwLocalRename(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7471 " call Dfunc("NetrwLocalRename(path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7472
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7473 " preparation for removing multiple files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7474 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7475 let svpos= netrw#NetrwSavePosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7476
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7477 " rename files given by the markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7478 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7479 for oldname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7480 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7481 if exists("subfrom")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7482 let newname= substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7483 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7484 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7485 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7486 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7487 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7488 if newname =~ '^s/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7489 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7490 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7491 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7492 let newname = substitute(oldname,subfrom,subto,'')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7493 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7494 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7495 call rename(oldname,newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7496 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7497 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7498
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7499 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7500
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7501 " attempt to rename files/directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7502 while ctr <= a:lastline
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7503 exe "keepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7504
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7505 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7506 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7507 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7508 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7509 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7510 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7511 if curword == "./" || curword == "../"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7512 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7513 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7514 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7515
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7516 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7517 let oldname= s:ComposePath(a:path,curword)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7518 " call Decho("oldname<".oldname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7519
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7520 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7521 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7522 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7523
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7524 call rename(oldname,newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7525 " call Decho("renaming <".oldname."> to <".newname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7526
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7527 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7528 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7529 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7530
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7531 " refresh the directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7532 " call Decho("refresh the directory listing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7533 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7534 call netrw#NetrwRestorePosn(svpos)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7535
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7536 " call Dret("NetrwLocalRename")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7537 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7538
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7539 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7540 " 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
7541 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7542 " g:netrw_ Directory Is
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7543 " fastbrowse Local Remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7544 " 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
7545 " 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
7546 " fast 2 H H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7547 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7548 " 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
7549 " 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
7550 " (re-using a buffer may not be as accurate)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7551 fun! s:LocalFastBrowser()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7552 " call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7553
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7554 " initialize browselist, a list of buffer numbers that the local browser has used
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7555 if !exists("s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7556 " call Decho("initialize s:netrw_browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7557 let s:netrw_browselist= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7558 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7559
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7560 " append current buffer to fastbrowse list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7561 if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1]
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7562 " call Decho("appendng current buffer to browselist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7563 call add(s:netrw_browselist,bufnr("%"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7564 " call Decho("browselist=".string(s:netrw_browselist))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7565 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7566
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7567 " enable autocmd events to handle refreshing/removing local browser buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7568 " If local browse buffer is currently showing: refresh it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7569 " If local browse buffer is currently hidden : wipe it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7570 if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7571 " call Decho("setting up local-browser shell command refresh")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7572 let s:netrw_browser_shellcmd= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7573 augroup AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7574 au!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7575 if (has("win32") || has("win95") || has("win64") || has("win16"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7576 " call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7577 au ShellCmdPost * call s:LocalBrowseShellCmdRefresh()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7578 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7579 au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7580 " call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7581 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7582 augroup END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7583 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7584
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7585 " user must have changed fastbrowse to its fast setting, so remove
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7586 " the associated autocmd events
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7587 if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7588 " call Decho("remove AuNetrwShellCmd autcmd group")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7589 unlet s:netrw_browser_shellcmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7590 augroup AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7591 au!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7592 augroup END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7593 augroup! AuNetrwShellCmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7594 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7595
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7596 " call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7597 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7598
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7599 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7600 " Support Functions: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7601
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7602 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7603 " netrw#ErrorMsg: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7604 " 0=note = s:NOTE
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7605 " 1=warning = s:WARNING
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7606 " 2=error = s:ERROR
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7607 " Dec 03, 2009 : max errnum currently is 76
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7608 fun! netrw#ErrorMsg(level,msg,errnum)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7609 " 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
7610
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7611 if a:level == 1
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7612 let level= "**warning** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7613 elseif a:level == 2
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7614 let level= "**error** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7615 else
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7616 let level= "**note** (netrw) "
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7617 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7618 " call Decho("level=".level)
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7619
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7620 if g:netrw_use_errorwindow
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7621 " (default) netrw creates a one-line window to show error/warning
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7622 " messages (reliably displayed)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7623
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7624 " record current window number for NetrwRestorePosn()'s benefit
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7625 let s:winBeforeErr= winnr()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7626 " call Decho("s:winBeforeErr=".s:winBeforeErr)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7627
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7628 " getting messages out reliably is just plain difficult!
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7629 " This attempt splits the current window, creating a one line window.
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7630 if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7631 " call Decho("write to NetrwMessage buffer")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7632 exe bufwinnr("NetrwMessage")."wincmd w"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7633 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7634 setlocal ma noro
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7635 call setline(line("$")+1,level.a:msg)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7636 keepj $
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7637 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7638 " call Decho("create a NetrwMessage buffer window")
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7639 bo 1split
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7640 call s:NetrwEnew()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7641 call s:NetrwSafeOptions()
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7642 setlocal bt=nofile
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7643 file NetrwMessage
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7644 " call Decho("setlocal ma noro")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7645 setlocal ma noro
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7646 call setline(line("$"),level.a:msg)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7647 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7648 " call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr())
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7649 if &fo !~ '[ta]'
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7650 syn clear
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7651 syn match netrwMesgNote "^\*\*note\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7652 syn match netrwMesgWarning "^\*\*warning\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7653 syn match netrwMesgError "^\*\*error\*\*"
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7654 hi link netrwMesgWarning WarningMsg
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7655 hi link netrwMesgError Error
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7656 endif
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7657 setlocal noma ro bh=wipe
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7658
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7659 else
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7660 " (optional) netrw will show messages using echomsg. Even if the
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7661 " message doesn't appear, at least it'll be recallable via :messages
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7662 " redraw!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7663 if a:level == s:WARNING
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7664 echohl WarningMsg
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7665 elseif a:level == s:ERROR
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7666 echohl Error
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7667 endif
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7668 echomsg level.a:msg
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7669 " call Decho("echomsg ***netrw*** ".a:msg)
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7670 echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7671 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7672
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7673 " call Dret("netrw#ErrorMsg")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7674 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7675
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7676 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7677 " 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
7678 fun! netrw#NetrwRestorePosn(...)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7679 " 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
7680 let eikeep= &ei
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7681 set ei=all
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7682 if expand("%") == "NetrwMessage"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7683 exe s:winBeforeErr."wincmd w"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7684 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7685
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7686 if a:0 > 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7687 exe a:1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7688 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7689
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7690 " restore window
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7691 if exists("w:netrw_winnr")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7692 " call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7693 exe "sil! ".w:netrw_winnr."wincmd w"
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7694 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7695 if v:shell_error == 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7696 " as suggested by Bram M: redraw on no error
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7697 " allows protocol error messages to remain visible
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7698 " redraw!
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7699 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7700
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7701 " restore top-of-screen line
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7702 if exists("w:netrw_hline")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7703 " call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7704 exe "keepj norm! ".w:netrw_hline."G0z\<CR>"
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7705 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7706
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7707 " restore position
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7708 if exists("w:netrw_line") && exists("w:netrw_col")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7709 " call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7710 exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>"
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7711 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7712
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7713 let &ei= eikeep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7714 " call Dret("netrw#NetrwRestorePosn")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7715 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7716
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7717 " ---------------------------------------------------------------------
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7718 " netrw#NetrwSavePosn: saves position of cursor on screen {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7719 fun! netrw#NetrwSavePosn()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7720 " call Dfunc("netrw#NetrwSavePosn()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7721 " Save current line and column
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7722 let w:netrw_winnr= winnr()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7723 let w:netrw_line = line(".")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7724 let w:netrw_col = virtcol(".")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7725 " 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
7726
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7727 " Save top-of-screen line
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7728 keepj norm! H0
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7729 let w:netrw_hline= line(".")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7730
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7731 " set up string holding position parameters
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7732 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
7733
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7734 call netrw#NetrwRestorePosn()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7735 " 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
7736 return ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7737 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7738
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7739 " ------------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7740 " netrw#RFC2396: converts %xx into characters {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7741 fun! netrw#RFC2396(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7742 " call Dfunc("netrw#RFC2396(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7743 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
7744 " call Dret("netrw#RFC2396 ".fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7745 return fname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7746 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7747
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7748 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7749 " 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
7750 fun! s:ComposePath(base,subdir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7751 " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7752
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7753 if(has("amiga"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7754 " call Decho("amiga")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7755 let ec = a:base[s:Strlen(a:base)-1]
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7756 if ec != '/' && ec != ':'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7757 let ret = a:base . "/" . a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7758 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7759 let ret = a:base . a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7760 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7761
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7762 elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7763 " call Decho("windows")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7764 let ret= a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7765
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7766 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
7767 " call Decho("windows")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7768 if a:base =~ '[/\\]$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7769 let ret= a:base.a:subdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7770 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7771 let ret= a:base."/".a:subdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7772 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7773
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7774 elseif a:base =~ '^\a\+://'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7775 " call Decho("remote linux/macos")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7776 let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7777 let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7778 if a:subdir == '../'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7779 if curpath =~ '[^/]/[^/]\+/$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7780 let curpath= substitute(curpath,'[^/]\+/$','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7781 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7782 let curpath=""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7783 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7784 let ret= urlbase.curpath
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7785 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7786 let ret= urlbase.curpath.a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7787 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7788 " call Decho("urlbase<".urlbase.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7789 " call Decho("curpath<".curpath.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7790 " call Decho("ret<".ret.">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7791
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7792 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7793 " call Decho("local linux/macos")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7794 let ret = substitute(a:base."/".a:subdir,"//","/","g")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7795 if a:base =~ '^//'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7796 " keeping initial '//' for the benefit of network share listing support
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7797 let ret= '/'.ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7798 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7799 let ret= simplify(ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7800 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7801
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7802 " call Dret("s:ComposePath ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7803 return ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7804 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7805
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7806 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7807 " s:FileReadable: o/s independent filereadable {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7808 fun! s:FileReadable(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7809 " call Dfunc("s:FileReadable(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7810
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7811 if g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7812 let ret= filereadable(substitute(a:fname,'/cygdrive/\(.\)','\1:/',''))
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7813 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7814 let ret= filereadable(a:fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7815 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7816
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7817 " call Dret("s:FileReadable ".ret)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7818 return ret
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7819 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7820
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7821 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7822 " 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
7823 " Places correct suffix on end of temporary filename,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7824 " using the suffix provided with fname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7825 fun! s:GetTempfile(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7826 " call Dfunc("s:GetTempfile(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7827
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7828 if !exists("b:netrw_tmpfile")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7829 " get a brand new temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7830 let tmpfile= tempname()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7831 " call Decho("tmpfile<".tmpfile."> : from tempname()")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7832
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7833 let tmpfile= substitute(tmpfile,'\','/','ge')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7834 " call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7835
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7836 " sanity check -- does the temporary file's directory exist?
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7837 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7838 " 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
7839 call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7840 " call Dret("s:GetTempfile getcwd<".getcwd().">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7841 return ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7842 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7843
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7844 " let netrw#NetSource() know about the tmpfile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7845 let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7846 " call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7847
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7848 " o/s dependencies
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7849 if g:netrw_cygwin != 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7850 let tmpfile = substitute(tmpfile,'^\(\a\):','/cygdrive/\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7851 elseif has("win32") || has("win95") || has("win64") || has("win16")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7852 if !exists("+shellslash") || !&ssl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7853 let tmpfile = substitute(tmpfile,'/','\','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7854 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7855 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7856 let tmpfile = tmpfile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7857 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7858 let b:netrw_tmpfile= tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7859 " call Decho("o/s dependent fixed tempname<".tmpfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7860 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7861 " re-use temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7862 let tmpfile= b:netrw_tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7863 " call Decho("tmpfile<".tmpfile."> re-using")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7864 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7865
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7866 " use fname's suffix for the temporary file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7867 if a:fname != ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7868 if a:fname =~ '\.[^./]\+$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7869 " call Decho("using fname<".a:fname.">'s suffix")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
7870 if a:fname =~ '\.tar\.gz$' || a:fname =~ '\.tar\.bz2$' || a:fname =~ '\.tar\.xz$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7871 let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
7872 elseif a:fname =~ '.txz$'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
7873 let suffix = ".txz".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7874 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7875 let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7876 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7877 " call Decho("suffix<".suffix.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7878 let tmpfile= substitute(tmpfile,'\.tmp$','','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7879 " call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7880 let tmpfile .= suffix
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7881 " call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7882 let s:netrw_tmpfile= tmpfile " supports netrw#NetSource()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7883 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7884 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7885
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7886 " 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
7887 " call Dret("s:GetTempfile <".tmpfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7888 return tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7889 endfun
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7890
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7891 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7892 " s:MakeSshCmd: transforms input command using USEPORT HOSTNAME into {{{2
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7893 " a correct command for use with a system() call
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7894 fun! s:MakeSshCmd(sshcmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7895 " 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
7896 let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user.s:machine,'')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7897 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7898 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.g:netrw_port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7899 elseif exists("s:port") && s:port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
7900 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.s:port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7901 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7902 let sshcmd= substitute(sshcmd,"USEPORT ",'','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7903 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7904 " call Dret("s:MakeSshCmd <".sshcmd.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
7905 return sshcmd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7906 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7907
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7908 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7909 " s:NetrwBMShow: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7910 fun! s:NetrwBMShow()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7911 " call Dfunc("s:NetrwBMShow()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7912 redir => bmshowraw
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7913 menu
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7914 redir END
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7915 let bmshowlist = split(bmshowraw,'\n')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7916 if bmshowlist != []
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7917 let bmshowfuncs= filter(bmshowlist,'v:val =~ "<SNR>\\d\\+_BMShow()"')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7918 if bmshowfuncs != []
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7919 let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7920 if bmshowfunc =~ '^call.*BMShow()'
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7921 exe "sil! ".bmshowfunc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7922 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7923 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7924 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7925 " call Dret("s:NetrwBMShow : bmshowfunc<".(exists("bmshowfunc")? bmshowfunc : 'n/a').">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7926 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7927
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7928 " ---------------------------------------------------------------------
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7929 " s:NetrwCursorline: {{{2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7930 fun! s:NetrwCursorline()
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7931 if !exists("w:netrw_liststyle")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7932 let w:netrw_liststyle= g:netrw_liststyle
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7933 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7934 " call Dfunc("s:NetrwCursorline() liststyle=".w:netrw_liststyle." g:netrw_cursorline=".g:netrw_cursorline." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7935 "
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7936 if w:netrw_liststyle != s:WIDELIST
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7937 " thin-long-tree listings
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7938 if g:netrw_cursorline == 2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7939 setlocal cursorline
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7940 let &l:cursorcolumn= s:netrw_usercuc
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7941 " call Decho("setlocal cursorline (cursorcolumn is ".((s:netrw_usercuc)? "on" : "off").")")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7942 elseif g:netrw_cursorline
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7943 setlocal cursorline
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7944 " call Decho("setlocal cursorline")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7945 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7946
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7947 else
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7948 " wide listings
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7949 if g:netrw_cursorline == 2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7950 setlocal cursorline cursorcolumn
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7951 " call Decho("setlocal cursorline cursorcolumn")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7952 elseif g:netrw_cursorline
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7953 let &l:cursorline= s:netrw_usercul
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7954 " call Decho("cursorline is ".((s:netrw_usercul)? "on" : "off").")")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7955 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7956 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7957 " call Dret("s:NetrwCursorline : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7958 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7959
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7960 " ---------------------------------------------------------------------
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7961 " s:RestoreCursorline: restores cursorline/cursorcolumn to original user settings {{{2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7962 fun! s:RestoreCursorline()
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7963 " call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%"))
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7964 let &l:cursorline = s:netrw_usercul
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7965 let &l:cursorcolumn = s:netrw_usercuc
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7966 " call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7967 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7968
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
7969 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7970 " s:NetrwDelete: Deletes a file. {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7971 " Uses Steve Hall's idea to insure that Windows paths stay
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7972 " acceptable. No effect on Unix paths.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7973 " Examples of use: let result= s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7974 fun! s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7975 " call Dfunc("s:NetrwDelete(path<".a:path.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7976
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7977 let path = netrw#WinPath(a:path)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7978 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7979 if exists("+shellslash")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7980 let sskeep= &shellslash
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7981 setlocal noshellslash
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7982 let result = delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7983 let &shellslash = sskeep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7984 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7985 " call Decho("exe let result= ".a:cmd."('".path."')")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7986 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7987 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7988 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7989 " call Decho("let result= delete(".path.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7990 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7991 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7992 if result < 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7993 call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7994 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7995
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7996 " call Dret("s:NetrwDelete ".result)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7997 return result
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7998 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7999
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8000 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8001 " 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
8002 fun! s:NetrwEnew(...)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8003 " call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8004 " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8005
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8006 " grab a function-local-variable copy of buffer variables
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8007 " call Decho("make function-local copy of netrw variables")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8008 if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8009 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
8010 if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8011 if exists("b:netrw_curdir") |let netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8012 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
8013 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
8014 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
8015 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
8016 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
8017 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
8018 if exists("b:netrw_fname") |let netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8019 if exists("b:netrw_lastfile") |let netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8020 if exists("b:netrw_liststyle") |let netrw_liststyle = b:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8021 if exists("b:netrw_method") |let netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8022 if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8023 if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif
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 call s:NetrwOptionRestore("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8026 " call Decho("generate a buffer with keepjumps keepalt enew!")
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
8027 let netrw_keepdiff= &l:diff
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8028 keepj keepalt enew!
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
8029 let &l:diff= netrw_keepdiff
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8030 " call Decho("bufnr($)=".bufnr("$"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8031 call s:NetrwOptionSave("w:")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8032
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8033 " copy function-local-variables to buffer variable equivalents
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8034 " call Decho("copy function-local variables back to buffer netrw variables")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8035 if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8036 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
8037 if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8038 if exists("netrw_curdir") |let b:netrw_curdir = netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8039 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
8040 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
8041 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
8042 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
8043 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
8044 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
8045 if exists("netrw_fname") |let b:netrw_fname = netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8046 if exists("netrw_lastfile") |let b:netrw_lastfile = netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8047 if exists("netrw_liststyle") |let b:netrw_liststyle = netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8048 if exists("netrw_method") |let b:netrw_method = netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8049 if exists("netrw_option") |let b:netrw_option = netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8050 if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8051
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8052 if a:0 > 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8053 let b:netrw_curdir= a:1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8054 if b:netrw_curdir =~ '/$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8055 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8056 file NetrwTreeListing
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8057 set bt=nowrite noswf
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8058 nno <silent> <buffer> [ :silent call <SID>TreeListMove('[')<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8059 nno <silent> <buffer> ] :silent call <SID>TreeListMove(']')<cr>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8060 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8061 exe "sil! keepalt file ".fnameescape(b:netrw_curdir)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8062 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8063 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8064 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8065
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8066 " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8067 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8068
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8069 " ------------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8070 " s:NetrwSaveWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8071 " changed sorting, etc. Also see s:NetrwRestoreWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8072 fun! s:NetrwSaveWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8073 " call Dfunc("NetrwSaveWordPosn()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8074 let s:netrw_saveword= '^'.fnameescape(getline('.')).'$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8075 " call Dret("NetrwSaveWordPosn : saveword<".s:netrw_saveword.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8076 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8077
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8078 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8079 " s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8080 " changed sorting, etc. Also see s:NetrwSaveWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8081 fun! s:NetrwRestoreWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8082 " call Dfunc("NetrwRestoreWordPosn()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8083 silent! call search(s:netrw_saveword,'w')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8084 " call Dret("NetrwRestoreWordPosn")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8085 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8086
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8087 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8088 " s:RestoreBufVars: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8089 fun! s:RestoreBufVars()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8090 " call Dfunc("s:RestoreBufVars()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8091
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8092 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
8093 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
8094 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
8095 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
8096 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
8097 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
8098
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8099 " call Dret("s:RestoreBufVars")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8100 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8101
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8102 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8103 " s:RemotePathAnalysis: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8104 fun! s:RemotePathAnalysis(dirname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8105 " call Dfunc("s:RemotePathAnalysis()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8106
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8107 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8108 let s:method = substitute(a:dirname,dirpat,'\1','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8109 let s:user = substitute(a:dirname,dirpat,'\2','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8110 let s:machine = substitute(a:dirname,dirpat,'\3','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8111 let s:port = substitute(a:dirname,dirpat,'\4','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8112 let s:path = substitute(a:dirname,dirpat,'\5','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8113 let s:fname = substitute(a:dirname,'^.*/\ze.','','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8114
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8115 " call Decho("set up s:method <".s:method .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8116 " call Decho("set up s:user <".s:user .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8117 " call Decho("set up s:machine<".s:machine.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8118 " call Decho("set up s:port <".s:port.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8119 " call Decho("set up s:path <".s:path .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8120 " call Decho("set up s:fname <".s:fname .">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8122 " call Dret("s:RemotePathAnalysis")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8123 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8124
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8125 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8126 " s:RemoteSystem: runs a command on a remote host using ssh {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8127 " Returns status
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8128 " Runs system() on
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8129 " [cd REMOTEDIRPATH;] a:cmd
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8130 " Note that it doesn't do shellescape(a:cmd)!
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8131 fun! s:RemoteSystem(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8132 " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8133 if !executable(g:netrw_ssh_cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8134 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
8135 elseif !exists("b:netrw_curdir")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8136 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
8137 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8138 let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8139 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8140 if remotedir != ""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8141 let cmd= cmd.' cd '.shellescape(remotedir).";"
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8142 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8143 let cmd= cmd.' '
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8144 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8145 let cmd= cmd.a:cmd
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8146 " call Decho("call system(".cmd.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8147 let ret= system(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8148 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8149 " call Dret("s:RemoteSystem ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8150 return ret
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8151 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8152
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8153 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8154 " s:RestoreWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8155 fun! s:RestoreWinVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8156 " call Dfunc("s:RestoreWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8157 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
8158 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
8159 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
8160 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
8161 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
8162 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
8163 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
8164 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
8165 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
8166 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
8167 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
8168 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
8169 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
8170 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
8171 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
8172 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
8173 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
8174 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
8175 " call Dret("s:RestoreWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8176 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8177
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8178 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8179 " s:Rexplore: implements returning from a buffer to a netrw directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8180 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8181 " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8182 " is true) and a command, :Rexplore, which call this function.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8183 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8184 " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8185 fun! s:NetrwRexplore(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8186 " call Dfunc("s:NetrwRexplore(islocal=".a:islocal." dirname<".a:dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8187 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8188 call netrw#LocalBrowseCheck(a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8189 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8190 call s:NetrwBrowse(0,a:dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8191 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8192 if exists("s:nbcd_curpos_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8193 call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')})
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8194 unlet s:nbcd_curpos_{bufnr('%')}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8195 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8196 if exists("s:explore_match")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8197 exe "2match netrwMarkFile /".s:explore_match."/"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8198 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8199 " call Dret("s:NetrwRexplore")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8200 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8201
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8202 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8203 " s:SaveBufVars: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8204 fun! s:SaveBufVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8205 " call Dfunc("s:SaveBufVars() buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8206
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8207 if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8208 if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8209 if exists("b:netrw_method") |let s:netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8210 if exists("b:netrw_fname") |let s:netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8211 if exists("b:netrw_machine") |let s:netrw_machine = b:netrw_machine |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8212 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
8213
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8214 " call Dret("s:SaveBufVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8215 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8216
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8217 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8218 " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8219 fun! s:SaveWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8220 " call Dfunc("s:SaveWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8221 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8222 if exists("w:netrw_col") |let s:col = w:netrw_col |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8223 if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8224 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
8225 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
8226 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
8227 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
8228 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
8229 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
8230 if exists("w:netrw_fpl") |let s:fpl = w:netrw_fpl |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8231 if exists("w:netrw_hline") |let s:hline = w:netrw_hline |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8232 if exists("w:netrw_line") |let s:line = w:netrw_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8233 if exists("w:netrw_liststyle") |let s:liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8234 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8235 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8236 if exists("w:netrw_treedict") |let s:treedict = w:netrw_treedict |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8237 if exists("w:netrw_treetop") |let s:treetop = w:netrw_treetop |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8238 if exists("w:netrw_winnr") |let s:winnr = w:netrw_winnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8239 " call Dret("s:SaveWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8240 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8241
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8242 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8243 " s:SetBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8244 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8245 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8246 " 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
8247 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8248 " UseBufWinVars() get around that.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
8249 fun! s:SetBufWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8250 " call Dfunc("s:SetBufWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8251 if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8252 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8253 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8254 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8255 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
8256 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
8257 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
8258 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
8259 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
8260 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
8261 " call Dret("s:SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8262 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8263
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8264 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8265 " s:SetRexDir: set directory for :Rexplore {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8266 fun! s:SetRexDir(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8267 " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8268 " set up Rex and leftmouse-double-click
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8269 if a:islocal
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8270 exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8271 if g:netrw_retmap
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8272 if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8273 nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8274 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8275 let dir = escape(a:dirname, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8276 exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(1,"'.dir.'")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8277 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8278 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8279 exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8280 if g:netrw_retmap
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8281 if !hasmapto("<Plug>NetrwReturn") && maparg("<2-leftmouse>","n") == ""
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8282 nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8283 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8284 let dir = escape(a:dirname, s:netrw_map_escape)
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8285 exe 'nnoremap <silent> <Plug>NetrwReturn :call <SID>NetrwRexplore(0,"'.dir.'")<cr>'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8286 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8287 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8288 " call Dret("s:SetRexDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8289 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8290
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8291 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8292 " 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
8293 " using two-byte etc characters.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8294 " Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck,
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8295 " and a bit from me.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8296 " 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
8297 fun! s:Strlen(x)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8298 " call Dfunc("s:Strlen(x<".a:x.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8299 if g:netrw_xstrlen == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8300 " number of codepoints (Latin a + combining circumflex is two codepoints)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8301 " (comment from TM, solution from NW)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8302 let ret= strlen(substitute(a:x,'.','c','g'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8303
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8304 elseif g:netrw_xstrlen == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8305 " number of spacing codepoints (Latin a + combining circumflex is one spacing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8306 " 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
8307 " (comment from TM, solution from TM)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8308 let ret=strlen(substitute(a:x, '.\Z', 'x', 'g'))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8309
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8310 elseif g:netrw_xstrlen == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8311 " virtual length (counting, for instance, tabs as anything between 1 and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8312 " '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
8313 " preceded by lam, one otherwise, etc.)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8314 " (comment from TM, solution from me)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8315 let modkeep= &mod
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8316 exe "keepj norm! o\<esc>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8317 call setline(line("."),a:x)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8318 let ret= virtcol("$") - 1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8319 keepj d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8320 let &mod= modkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8321
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8322 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8323 " at least give a decent default
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8324 let ret= strlen(a:x)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8325 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8326 " call Dret("s:Strlen ".ret)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8327 return ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8328 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8329
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8330 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8331 " s:TreeListMove: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8332 fun! s:TreeListMove(dir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8333 " call Dfunc("s:TreeListMove(dir<".a:dir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8334 let curline = getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8335 let prvline = (line(".") > 1)? getline(line(".")-1) : ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8336 let nxtline = (line(".") < line("$"))? getline(line(".")+1) : ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8337 let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8338 let indentm1 = substitute(curindent,'^| ','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8339 " call Decho("prvline <".prvline."> #".line(".")-1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8340 " call Decho("curline <".curline."> #".line("."))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8341 " call Decho("nxtline <".nxtline."> #".line(".")+1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8342 " call Decho("curindent<".curindent.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8343 " call Decho("indentm1 <".indentm1.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8344
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8345 if curline !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8346 " call Decho('regfile')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8347 if a:dir == '[' && prvline != ''
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8348 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8349 let nl = search('^'.indentm1.'[^|]','bWe') " search backwards from regular file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8350 " call Decho("regfile srch back: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8351 elseif a:dir == ']' && nxtline != ''
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8352 keepj norm! $
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8353 let nl = search('^'.indentm1.'[^|]','We') " search forwards from regular file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8354 " call Decho("regfile srch fwd: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8355 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8356
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8357 elseif a:dir == '[' && prvline != ''
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8358 keepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8359 let curline= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8360 let nl = search('^'.curindent.'[^|]','bWe') " search backwards From directory, same indentation
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8361 " call Decho("dir srch back ind: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8362 if nl != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8363 if line(".") == curline-1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8364 let nl= search('^'.indentm1.'[^|]','bWe') " search backwards from directory, indentation - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8365 " call Decho("dir srch back ind-1: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8366 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8367 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8368
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8369 elseif a:dir == ']' && nxtline != ''
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8370 keepj norm! $
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8371 let curline = line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8372 let nl = search('^'.curindent.'[^|]','We') " search forwards from directory, same indentation
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8373 " call Decho("dir srch fwd ind: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8374 if nl != 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8375 if line(".") == curline+1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8376 let nl= search('^'.indentm1.'[^|]','We') " search forwards from directory, indentation - 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8377 " call Decho("dir srch fwd ind-1: ".nl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8378 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8379 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8380
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8381 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8382
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8383 " call Dret("s:TreeListMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8384 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8385
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8386 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8387 " 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
8388 " 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
8389 " 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
8390 " 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
8391 fun! s:UpdateBuffersMenu()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8392 " call Dfunc("s:UpdateBuffersMenu()")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8393 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
8394 try
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8395 silent emenu Buffers.Refresh\ menu
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8396 catch /^Vim\%((\a\+)\)\=:E/
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8397 let v:errmsg= ""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8398 silent call s:NetrwBMShow()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8399 endtry
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8400 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8401 " call Dret("s:UpdateBuffersMenu")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8402 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8403
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8404 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8405 " s:UseBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck() {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8406 " Matching function to BufferWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8407 fun! s:UseBufWinVars()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8408 " call Dfunc("s:UseBufWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8409 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
8410 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
8411 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
8412 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
8413 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
8414 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
8415 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
8416 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
8417 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
8418 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
8419 " call Dret("s:UseBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8420 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8421
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
8422 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8423 " 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
8424 fun! netrw#WinPath(path)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8425 " call Dfunc("netrw#WinPath(path<".a:path.">)")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8426 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
8427 " remove cygdrive prefix, if present
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8428 let path = substitute(a:path,'/cygdrive/\(.\)','\1:','')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8429 " remove trailing slash (Win95)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8430 let path = substitute(path, '\(\\\|/\)$', '', 'g')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8431 " remove escaped spaces
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8432 let path = substitute(path, '\ ', ' ', 'g')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8433 " convert slashes to backslashes
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8434 let path = substitute(path, '/', '\', 'g')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8435 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8436 let path= a:path
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8437 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8438 " call Dret("netrw#WinPath <".path.">")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8439 return path
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8440 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8441
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8442 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
8443 " Settings Restoration: {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8444 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8445 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8446
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8447 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8448 " Modelines: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8449 " vim:ts=8 fdm=marker