annotate runtime/autoload/netrw.vim @ 18527:edccc0b13ac3

Added tag v8.1.2257 for changeset 334b1f897f3a1769683ab72080f63f1f53855b95
author Bram Moolenaar <Bram@vim.org>
date Tue, 05 Nov 2019 21:15:05 +0100
parents ca8e754bdd53
children e9a47bcf7b94
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
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3 " Date: Jul 16, 2019
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4 " Version: 165
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7 " Copyright: Copyright (C) 2016 Charles E. Campbell {{{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.
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
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
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
25
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
26 " Check that vim has patches that netrw requires.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
27 " Patches needed for v7.4: 1557, and 213.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
28 " (netrw will benefit from vim's having patch#656, too)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
29 let s:needspatches=[1557,213]
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
30 if exists("s:needspatches")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
31 for ptch in s:needspatches
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
32 if v:version < 704 || (v:version == 704 && !has("patch".ptch))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
33 if !exists("s:needpatch{ptch}")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
34 unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch#".ptch
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
35 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
36 let s:needpatch{ptch}= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
37 finish
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
38 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
39 endfor
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
40 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
41
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
42 let g:loaded_netrw = "v165"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
43 if !exists("s:NOTE")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
44 let s:NOTE = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
45 let s:WARNING = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
46 let s:ERROR = 2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
47 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
48
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
49 let s:keepcpo= &cpo
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
50 setl cpo&vim
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
51 "DechoFuncName 1
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
52 "DechoRemOn
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
53 "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
54
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
55 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
56 " Netrw Variables: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
57 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
58
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
59 " ---------------------------------------------------------------------
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
60 " netrw#ErrorMsg: {{{2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
61 " 0=note = s:NOTE
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
62 " 1=warning = s:WARNING
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
63 " 2=error = s:ERROR
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
64 " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
65 " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
66 " (this function can optionally take a list of messages)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
67 " Mar 21, 2017 : max errnum currently is 105
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
68 fun! netrw#ErrorMsg(level,msg,errnum)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
69 " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
70
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
71 if a:level < g:netrw_errorlvl
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
72 " call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g:netrw_errorlvl=".g:netrw_errorlvl)
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
73 return
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
74 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
75
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
76 if a:level == 1
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
77 let level= "**warning** (netrw) "
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
78 elseif a:level == 2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
79 let level= "**error** (netrw) "
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
80 else
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
81 let level= "**note** (netrw) "
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
82 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
83 " call Decho("level=".level,'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
84
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
85 if g:netrw_use_errorwindow
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
86 " (default) netrw creates a one-line window to show error/warning
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
87 " messages (reliably displayed)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
88
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
89 " record current window number
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
90 let s:winBeforeErr= winnr()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
91 " call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
92
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
93 " getting messages out reliably is just plain difficult!
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
94 " This attempt splits the current window, creating a one line window.
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
95 if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
96 " call Decho("write to NetrwMessage buffer",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
97 exe bufwinnr("NetrwMessage")."wincmd w"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
98 " call Decho("setl ma noro",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
99 setl ma noro
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
100 if type(a:msg) == 3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
101 for msg in a:msg
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
102 NetrwKeepj call setline(line("$")+1,level.msg)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
103 endfor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
104 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
105 NetrwKeepj call setline(line("$")+1,level.a:msg)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
106 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
107 NetrwKeepj $
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
108 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
109 " call Decho("create a NetrwMessage buffer window",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
110 bo 1split
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
111 sil! call s:NetrwEnew()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
112 sil! NetrwKeepj call s:NetrwOptionsSafe(1)
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
113 setl bt=nofile
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
114 NetrwKeepj file NetrwMessage
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
115 " call Decho("setl ma noro",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
116 setl ma noro
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
117 if type(a:msg) == 3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
118 for msg in a:msg
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
119 NetrwKeepj call setline(line("$")+1,level.msg)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
120 endfor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
121 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
122 NetrwKeepj call setline(line("$"),level.a:msg)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
123 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
124 NetrwKeepj $
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
125 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
126 " call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr(),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
127 if &fo !~ '[ta]'
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
128 syn clear
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
129 syn match netrwMesgNote "^\*\*note\*\*"
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
130 syn match netrwMesgWarning "^\*\*warning\*\*"
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
131 syn match netrwMesgError "^\*\*error\*\*"
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
132 hi link netrwMesgWarning WarningMsg
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
133 hi link netrwMesgError Error
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
134 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
135 " call Decho("setl noma ro bh=wipe",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
136 setl ro nomod noma bh=wipe
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
137
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
138 else
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
139 " (optional) netrw will show messages using echomsg. Even if the
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
140 " message doesn't appear, at least it'll be recallable via :messages
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
141 " redraw!
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
142 if a:level == s:WARNING
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
143 echohl WarningMsg
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
144 elseif a:level == s:ERROR
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
145 echohl Error
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
146 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
147
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
148 if type(a:msg) == 3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
149 for msg in a:msg
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
150 unsilent echomsg level.msg
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
151 endfor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
152 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
153 unsilent echomsg level.a:msg
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
154 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
155
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
156 " call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
157 echohl None
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
158 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
159
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
160 " call Dret("netrw#ErrorMsg")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
161 endfun
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
162
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
163 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
164 " s:NetrwInit: initializes variables if they haven't been defined {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
165 " Loosely, varname = value.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
166 fun s:NetrwInit(varname,value)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
167 " call Decho("varname<".a:varname."> value=".a:value,'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
168 if !exists(a:varname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
169 if type(a:value) == 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
170 exe "let ".a:varname."=".a:value
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
171 elseif type(a:value) == 1 && a:value =~ '^[{[]'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
172 exe "let ".a:varname."=".a:value
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
173 elseif type(a:value) == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
174 exe "let ".a:varname."="."'".a:value."'"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
175 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
176 exe "let ".a:varname."=".a:value
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
177 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
178 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
179 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
180
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
181 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
182 " Netrw Constants: {{{2
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
183 call s:NetrwInit("g:netrw_dirhistcnt",0)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
184 if !exists("s:LONGLIST")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
185 call s:NetrwInit("s:THINLIST",0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
186 call s:NetrwInit("s:LONGLIST",1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
187 call s:NetrwInit("s:WIDELIST",2)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
188 call s:NetrwInit("s:TREELIST",3)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
189 call s:NetrwInit("s:MAXLIST" ,4)
1121
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
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
192 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
193 " Default option values: {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
194 let g:netrw_localcopycmdopt = ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
195 let g:netrw_localcopydircmdopt = ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
196 let g:netrw_localmkdiropt = ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
197 let g:netrw_localmovecmdopt = ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
198 let g:netrw_localrmdiropt = ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
199
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
200 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
201 " Default values for netrw's global protocol variables {{{2
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
202 call s:NetrwInit("g:netrw_use_errorwindow",1)
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
203
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
204 if !exists("g:netrw_dav_cmd")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
205 if executable("cadaver")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
206 let g:netrw_dav_cmd = "cadaver"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
207 elseif executable("curl")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
208 let g:netrw_dav_cmd = "curl"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
209 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
210 let g:netrw_dav_cmd = ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
211 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
212 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
213 if !exists("g:netrw_fetch_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
214 if executable("fetch")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
215 let g:netrw_fetch_cmd = "fetch -o"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
216 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
217 let g:netrw_fetch_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
218 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
219 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
220 if !exists("g:netrw_file_cmd")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
221 if executable("elinks")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
222 call s:NetrwInit("g:netrw_file_cmd","elinks")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
223 elseif executable("links")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
224 call s:NetrwInit("g:netrw_file_cmd","links")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
225 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
226 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
227 if !exists("g:netrw_ftp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
228 let g:netrw_ftp_cmd = "ftp"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
229 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
230 let s:netrw_ftp_cmd= g:netrw_ftp_cmd
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
231 if !exists("g:netrw_ftp_options")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
232 let g:netrw_ftp_options= "-i -n"
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
233 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
234 if !exists("g:netrw_http_cmd")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
235 if executable("curl")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
236 let g:netrw_http_cmd = "curl"
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
237 call s:NetrwInit("g:netrw_http_xcmd","-L -o")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
238 elseif executable("wget")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
239 let g:netrw_http_cmd = "wget"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
240 call s:NetrwInit("g:netrw_http_xcmd","-q -O")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
241 elseif executable("elinks")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
242 let g:netrw_http_cmd = "elinks"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
243 call s:NetrwInit("g:netrw_http_xcmd","-source >")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
244 elseif executable("fetch")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
245 let g:netrw_http_cmd = "fetch"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
246 call s:NetrwInit("g:netrw_http_xcmd","-o")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
247 elseif executable("links")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
248 let g:netrw_http_cmd = "links"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
249 call s:NetrwInit("g:netrw_http_xcmd","-http.extra-header ".shellescape("Accept-Encoding: identity", 1)." -source >")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
250 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
251 let g:netrw_http_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
252 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
253 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
254 call s:NetrwInit("g:netrw_http_put_cmd","curl -T")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
255 call s:NetrwInit("g:netrw_keepj","keepj")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
256 call s:NetrwInit("g:netrw_rcp_cmd" , "rcp")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
257 call s:NetrwInit("g:netrw_rsync_cmd", "rsync")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
258 call s:NetrwInit("g:netrw_rsync_sep", "/")
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
259 if !exists("g:netrw_scp_cmd")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
260 if executable("scp")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
261 call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
262 elseif executable("pscp")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
263 if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable('c:\private.ppk')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
264 call s:NetrwInit("g:netrw_scp_cmd", 'pscp -i c:\private.ppk')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
265 else
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
266 call s:NetrwInit("g:netrw_scp_cmd", 'pscp -q')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
267 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
268 else
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
269 call s:NetrwInit("g:netrw_scp_cmd" , "scp -q")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
270 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
271 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
272
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
273 call s:NetrwInit("g:netrw_sftp_cmd" , "sftp")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
274 call s:NetrwInit("g:netrw_ssh_cmd" , "ssh")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
275
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
276 if (has("win32") || has("win95") || has("win64") || has("win16"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
277 \ && exists("g:netrw_use_nt_rcp")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
278 \ && g:netrw_use_nt_rcp
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
279 \ && executable( $SystemRoot .'/system32/rcp.exe')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
280 let s:netrw_has_nt_rcp = 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
281 let s:netrw_rcpmode = '-b'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
282 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
283 let s:netrw_has_nt_rcp = 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
284 let s:netrw_rcpmode = ''
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
285 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
286
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
287 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
288 " Default values for netrw's global variables {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
289 " Cygwin Detection ------- {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
290 if !exists("g:netrw_cygwin")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
291 if has("win32") || has("win95") || has("win64") || has("win16")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
292 if has("win32unix") && &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
293 let g:netrw_cygwin= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
294 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
295 let g:netrw_cygwin= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
296 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
297 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
298 let g:netrw_cygwin= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
299 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
300 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
301 " Default values - a-c ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
302 call s:NetrwInit("g:netrw_alto" , &sb)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
303 call s:NetrwInit("g:netrw_altv" , &spr)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
304 call s:NetrwInit("g:netrw_banner" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
305 call s:NetrwInit("g:netrw_browse_split", 0)
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
306 call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro nornu")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
307 call s:NetrwInit("g:netrw_chgwin" , -1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
308 call s:NetrwInit("g:netrw_compress" , "gzip")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
309 call s:NetrwInit("g:netrw_ctags" , "ctags")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
310 if exists("g:netrw_cursorline") && !exists("g:netrw_cursor")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
311 call netrw#ErrorMsg(s:NOTE,'g:netrw_cursorline is deprecated; use g:netrw_cursor instead',77)
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
312 let g:netrw_cursor= g:netrw_cursorline
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
313 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
314 call s:NetrwInit("g:netrw_cursor" , 2)
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
315 let s:netrw_usercul = &cursorline
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
316 let s:netrw_usercuc = &cursorcolumn
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
317 call s:NetrwInit("g:netrw_cygdrive","/cygdrive")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
318 " Default values - d-g ---------- {{{3
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
319 call s:NetrwInit("s:didstarstar",0)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
320 call s:NetrwInit("g:netrw_dirhistcnt" , 0)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
321 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
322 call s:NetrwInit("g:netrw_dirhistmax" , 10)
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
323 call s:NetrwInit("g:netrw_errorlvl" , s:NOTE)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
324 call s:NetrwInit("g:netrw_fastbrowse" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
325 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
326 if !exists("g:netrw_ftp_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
327 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
328 let g:netrw_ftp_list_cmd = "ls -lF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
329 let g:netrw_ftp_timelist_cmd = "ls -tlF"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
330 let g:netrw_ftp_sizelist_cmd = "ls -slF"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
331 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
332 let g:netrw_ftp_list_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
333 let g:netrw_ftp_timelist_cmd = "dir"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
334 let g:netrw_ftp_sizelist_cmd = "dir"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
335 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
336 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
337 call s:NetrwInit("g:netrw_ftpmode",'binary')
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
338 " Default values - h-lh ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
339 call s:NetrwInit("g:netrw_hide",1)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
340 if !exists("g:netrw_ignorenetrc")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
341 if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
342 let g:netrw_ignorenetrc= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
343 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
344 let g:netrw_ignorenetrc= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
345 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
346 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
347 call s:NetrwInit("g:netrw_keepdir",1)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
348 if !exists("g:netrw_list_cmd")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
349 if g:netrw_scp_cmd =~ '^pscp' && executable("pscp")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
350 if (has("win32") || has("win95") || has("win64") || has("win16")) && filereadable("c:\\private.ppk")
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
351 " provide a pscp-based listing command
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
352 let g:netrw_scp_cmd ="pscp -i C:\\private.ppk"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
353 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
354 if exists("g:netrw_list_cmd_options")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
355 let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
356 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
357 let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
358 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
359 elseif executable(g:netrw_ssh_cmd)
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
360 " provide a scp-based default listing command
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
361 if exists("g:netrw_list_cmd_options")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
362 let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa ".g:netrw_list_cmd_options
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
363 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
364 let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
365 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
366 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
367 " call Decho(g:netrw_ssh_cmd." is not executable",'~'.expand("<slnum>"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
368 let g:netrw_list_cmd= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
369 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
370 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
371 call s:NetrwInit("g:netrw_list_hide","")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
372 " Default values - lh-lz ---------- {{{3
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
373 if exists("g:netrw_local_copycmd")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
374 let g:netrw_localcopycmd= g:netrw_local_copycmd
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
375 call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
376 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
377 if !exists("g:netrw_localcmdshell")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
378 let g:netrw_localcmdshell= ""
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
379 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
380 if !exists("g:netrw_localcopycmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
381 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
382 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
383 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
384 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
385 let g:netrw_localcopycmd = expand("$COMSPEC")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
386 let g:netrw_localcopycmdopt= " /c copy"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
387 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
388 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
389 let g:netrw_localcopycmd= "cp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
390 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
391 let g:netrw_localcopycmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
392 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
393 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
394 if !exists("g:netrw_localcopydircmd")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
395 if has("win32") || has("win95") || has("win64") || has("win16")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
396 if g:netrw_cygwin
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
397 let g:netrw_localcopydircmd = "cp"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
398 let g:netrw_localcopydircmdopt= " -R"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
399 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
400 let g:netrw_localcopydircmd = expand("$COMSPEC")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
401 let g:netrw_localcopydircmdopt= " /c xcopy /e /c /h /i /k"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
402 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
403 elseif has("unix")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
404 let g:netrw_localcopydircmd = "cp"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
405 let g:netrw_localcopydircmdopt= " -R"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
406 elseif has("macunix")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
407 let g:netrw_localcopydircmd = "cp"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
408 let g:netrw_localcopydircmdopt= " -R"
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
409 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
410 let g:netrw_localcopydircmd= ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
411 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
412 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
413 if exists("g:netrw_local_mkdir")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
414 let g:netrw_localmkdir= g:netrw_local_mkdir
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
415 call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
416 endif
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
417 if has("win32") || has("win95") || has("win64") || has("win16")
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
418 if g:netrw_cygwin
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
419 call s:NetrwInit("g:netrw_localmkdir","mkdir")
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
420 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
421 let g:netrw_localmkdir = expand("$COMSPEC")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
422 let g:netrw_localmkdiropt= " /c mkdir"
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
423 endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
424 else
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
425 call s:NetrwInit("g:netrw_localmkdir","mkdir")
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
426 endif
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
427 call s:NetrwInit("g:netrw_remote_mkdir","mkdir")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
428 if exists("g:netrw_local_movecmd")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
429 let g:netrw_localmovecmd= g:netrw_local_movecmd
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
430 call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
431 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
432 if !exists("g:netrw_localmovecmd")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
433 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
434 if g:netrw_cygwin
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
435 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
436 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
437 let g:netrw_localmovecmd = expand("$COMSPEC")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
438 let g:netrw_localmovecmdopt= " /c move"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
439 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
440 elseif has("unix") || has("macunix")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
441 let g:netrw_localmovecmd= "mv"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
442 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
443 let g:netrw_localmovecmd= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
444 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
445 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
446 if v:version < 704 || (v:version == 704 && !has("patch1107"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
447 " 1109 provides for delete(tmpdir,"d") which is what will be used
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
448 if exists("g:netrw_local_rmdir")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
449 let g:netrw_localrmdir= g:netrw_local_rmdir
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
450 call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
451 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
452 if has("win32") || has("win95") || has("win64") || has("win16")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
453 if g:netrw_cygwin
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
454 call s:NetrwInit("g:netrw_localrmdir","rmdir")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
455 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
456 let g:netrw_localrmdir = expand("$COMSPEC")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
457 let g:netrw_localrmdiropt= " /c rmdir"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
458 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
459 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
460 call s:NetrwInit("g:netrw_localrmdir","rmdir")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
461 endif
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
462 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
463 call s:NetrwInit("g:netrw_liststyle" , s:THINLIST)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
464 " sanity checks
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
465 if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
466 let g:netrw_liststyle= s:THINLIST
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
467 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
468 if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
469 let g:netrw_list_cmd= g:netrw_list_cmd." -l"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
470 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
471 " Default values - m-r ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
472 call s:NetrwInit("g:netrw_markfileesc" , '*./[\~')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
473 call s:NetrwInit("g:netrw_maxfilenamelen", 32)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
474 call s:NetrwInit("g:netrw_menu" , 1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
475 call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir")
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
476 call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~# '[anh]'))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
477 call s:NetrwInit("g:netrw_retmap" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
478 if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
479 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
480 elseif has("win32") || has("win95") || has("win64") || has("win16")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
481 call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
482 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
483 call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
484 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
485 call s:NetrwInit("g:netrw_preview" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
486 call s:NetrwInit("g:netrw_scpport" , "-P")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
487 call s:NetrwInit("g:netrw_servername" , "NETRWSERVER")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
488 call s:NetrwInit("g:netrw_sshport" , "-p")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
489 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
490 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
491 call s:NetrwInit("g:netrw_rmdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
492 call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f ")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
493 " Default values - q-s ---------- {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
494 call s:NetrwInit("g:netrw_quickhelp",0)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
495 let s:QuickHelp= ["-:go up dir D:delete R:rename s:sort-by x:special",
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
496 \ "(create new) %:file d:directory",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
497 \ "(windows split&open) o:horz v:vert p:preview",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
498 \ "i:style qf:file info O:obtain r:reverse",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
499 \ "(marks) mf:mark file mt:set target mm:move mc:copy",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
500 \ "(bookmarks) mb:make mB:delete qb:list gb:go to",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
501 \ "(history) qb:list u:go up U:go down",
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
502 \ "(targets) mt:target Tb:use bookmark Th:use history"]
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
503 " 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
504 call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\<Char-0x01>" : "\<Char-0xff>")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
505 if !exists("g:netrw_keepj") || g:netrw_keepj == "keepj"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
506 call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
507 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
508 call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil " : " ")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
509 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
510 call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
511 call s:NetrwInit("g:netrw_sort_options" , "")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
512 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
513 if !exists("g:netrw_sort_sequence")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
514 if has("unix")
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
515 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
516 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
517 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
518 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
519 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
520 call s:NetrwInit("g:netrw_special_syntax" , 0)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
521 call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
522 call s:NetrwInit("g:netrw_suppress_gx_mesg", 1)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
523 call s:NetrwInit("g:netrw_use_noswf" , 1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
524 call s:NetrwInit("g:netrw_sizestyle" ,"b")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
525 " Default values - t-w ---------- {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
526 call s:NetrwInit("g:netrw_timefmt","%c")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
527 if !exists("g:netrw_xstrlen")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
528 if exists("g:Align_xstrlen")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
529 let g:netrw_xstrlen= g:Align_xstrlen
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
530 elseif exists("g:drawit_xstrlen")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
531 let g:netrw_xstrlen= g:drawit_xstrlen
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
532 elseif &enc == "latin1" || !has("multi_byte")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
533 let g:netrw_xstrlen= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
534 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
535 let g:netrw_xstrlen= 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
536 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
537 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
538 call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
539 call s:NetrwInit("g:netrw_win95ftp",1)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
540 call s:NetrwInit("g:netrw_winsize",50)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
541 call s:NetrwInit("g:netrw_wiw",1)
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
542 if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
543 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
544 " Default values for netrw's script variables: {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
545 call s:NetrwInit("g:netrw_fname_escape",' ?&;%')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
546 if has("win32") || has("win95") || has("win64") || has("win16")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
547 call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
548 else
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
549 call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\')
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
550 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
551 call s:NetrwInit("g:netrw_menu_escape",'.&? \')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
552 call s:NetrwInit("g:netrw_tmpfile_escape",' &;')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
553 call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
554 if has("gui_running") && (&enc == 'utf-8' || &enc == 'utf-16' || &enc == 'ucs-4')
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
555 let s:treedepthstring= "│ "
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
556 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
557 let s:treedepthstring= "| "
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
558 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
559 call s:NetrwInit("s:netrw_posn",'{}')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
560
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
561 " BufEnter event ignored by decho when following variable is true
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 " Has a side effect that doau BufReadPost doesn't work, so
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
563 " files read by network transfer aren't appropriately highlighted.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
564 "let g:decho_bufenter = 1 "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
565
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
566 " ======================
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
567 " Netrw Initialization: {{{1
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
568 " ======================
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
569 if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
570 " call Decho("installed beval events",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
571 let &l:bexpr = "netrw#BalloonHelp()"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
572 au FileType netrw setl beval
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
573 au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
574 au VimEnter * let s:initbeval= &beval
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
575 "else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
576 " if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700","~".expand("<slnum>")) | endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
577 " if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("<slnum>")) | endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
578 " if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("<slnum>")) | endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
579 " if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("<slnum>")) | endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
580 " if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("<slnum>")) | endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
581 " if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("<slnum>")) | endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
582 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
583 au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
584
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
585 if g:netrw_keepj =~# "keepj"
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
586 com! -nargs=* NetrwKeepj keepj <args>
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
587 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
588 let g:netrw_keepj= ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
589 com! -nargs=* NetrwKeepj <args>
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
590 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
591
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
592 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
593 " Netrw Utility Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
594 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
595
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
596 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
597 " netrw#BalloonHelp: {{{2
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
598 if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
599 " call Decho("loading netrw#BalloonHelp()",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
600 fun! netrw#BalloonHelp()
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
601 if &ft != "netrw"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
602 return ""
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
603 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
604 if !exists("w:netrw_bannercnt") || v:beval_lnum >= w:netrw_bannercnt || (exists("g:netrw_nobeval") && g:netrw_nobeval)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
605 let mesg= ""
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
606 elseif v:beval_text == "Netrw" || v:beval_text == "Directory" || v:beval_text == "Listing"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
607 let mesg = "i: thin-long-wide-tree gh: quick hide/unhide of dot-files qf: quick file info %:open new file"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
608 elseif getline(v:beval_lnum) =~ '^"\s*/'
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
609 let mesg = "<cr>: edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
610 elseif v:beval_text == "Sorted" || v:beval_text == "by"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
611 let mesg = 's: sort by name, time, file size, extension r: reverse sorting order mt: mark target'
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
612 elseif v:beval_text == "Sort" || v:beval_text == "sequence"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
613 let mesg = "S: edit sorting sequence"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
614 elseif v:beval_text == "Hiding" || v:beval_text == "Showing"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
615 let mesg = "a: hiding-showing-all ctrl-h: editing hiding list mh: hide/show by suffix"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
616 elseif v:beval_text == "Quick" || v:beval_text == "Help"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
617 let mesg = "Help: press <F1>"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
618 elseif v:beval_text == "Copy/Move" || v:beval_text == "Tgt"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
619 let mesg = "mt: mark target mc: copy marked file to target mm: move marked file to target"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
620 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
621 let mesg= ""
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
622 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
623 return mesg
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
624 endfun
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
625 "else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
626 " if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -","~".expand("<slnum>"))|endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
627 " if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("<slnum>")) |endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
628 " if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("<slnum>")) |endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
629 " if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("<slnum>")) |endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
630 " if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("<slnum>")) |endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
631 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
632
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
633 " ------------------------------------------------------------------------
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
634 " netrw#Explore: launch the local browser in the directory of the current file {{{2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
635 " indx: == -1: Nexplore
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
636 " == -2: Pexplore
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
637 " == +: this is overloaded:
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
638 " * If Nexplore/Pexplore is in use, then this refers to the
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
639 " indx'th item in the w:netrw_explore_list[] of items which
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
640 " matched the */pattern **/pattern *//pattern **//pattern
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
641 " * If Hexplore or Vexplore, then this will override
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
642 " g:netrw_winsize to specify the qty of rows or columns the
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
643 " newly split window should have.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
644 " dosplit==0: the window will be split iff the current file has been modified and hidden not set
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
645 " dosplit==1: the window will be split before running the local browser
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
646 " style == 0: Explore style == 1: Explore!
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
647 " == 2: Hexplore style == 3: Hexplore!
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
648 " == 4: Vexplore style == 5: Vexplore!
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
649 " == 6: Texplore
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
650 fun! netrw#Explore(indx,dosplit,style,...)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
651 " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")." ft=".&ft)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
652 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
653 if !exists("b:netrw_curdir")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
654 let b:netrw_curdir= getcwd()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
655 " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
656 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
657
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
658 " record current file for Rexplore's benefit
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
659 if &ft != "netrw"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
660 let w:netrw_rexfile= expand("%:p")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
661 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
662
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
663 " record current directory
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
664 let curdir = simplify(b:netrw_curdir)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
665 let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
666 if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
667 let curdir= substitute(curdir,'\','/','g')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
668 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
669 " call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
670
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
671 " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
672 " will end up with backslashes here. Solution: strip off backslashes that precede white space and
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
673 " try Explore again.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
674 if a:0 > 0
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
675 " call Decho('considering retry: a:1<'.a:1.'>: '.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
676 \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
677 \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
678 \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory',
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
679 \ '~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
680 if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
681 " call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
682 call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
683 " call Dret("netrw#Explore : returning from retry")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
684 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
685 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
686 " call Decho("retry not needed",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
687 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
688 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
689
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
690 " save registers
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
691 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
692 sil! let keepregstar = @*
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
693 sil! let keepregplus = @+
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
694 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
695 sil! let keepregslash= @/
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
696
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
697 " if dosplit
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
698 " -or- file has been modified AND file not hidden when abandoned
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
699 " -or- Texplore used
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
700 if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
701 " call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
702 call s:SaveWinVars()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
703 let winsz= g:netrw_winsize
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
704 if a:indx > 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
705 let winsz= a:indx
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
706 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
707
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
708 if a:style == 0 " Explore, Sexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
709 " call Decho("style=0: Explore or Sexplore",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
710 let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
711 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
712 exe "noswapfile ".winsz."wincmd s"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
713 " call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
714
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
715 elseif a:style == 1 "Explore!, Sexplore!
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
716 " call Decho("style=1: Explore! or Sexplore!",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
717 let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
718 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
719 exe "keepalt noswapfile ".winsz."wincmd v"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
720 " call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
721
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
722 elseif a:style == 2 " Hexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
723 " call Decho("style=2: Hexplore",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
724 let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
725 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
726 exe "keepalt noswapfile bel ".winsz."wincmd s"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
727 " call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
728
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
729 elseif a:style == 3 " Hexplore!
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
730 " call Decho("style=3: Hexplore!",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
731 let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
732 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
733 exe "keepalt noswapfile abo ".winsz."wincmd s"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
734 " call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
735
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
736 elseif a:style == 4 " Vexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
737 " call Decho("style=4: Vexplore",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
738 let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
739 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
740 exe "keepalt noswapfile lefta ".winsz."wincmd v"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
741 " call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
742
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
743 elseif a:style == 5 " Vexplore!
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
744 " call Decho("style=5: Vexplore!",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
745 let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
746 if winsz == 0|let winsz= ""|endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
747 exe "keepalt noswapfile rightb ".winsz."wincmd v"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
748 " call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
749
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
750 elseif a:style == 6 " Texplore
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
751 call s:SaveBufVars()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
752 " call Decho("style = 6: Texplore",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
753 exe "keepalt tabnew ".fnameescape(curdir)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
754 " call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
755 call s:RestoreBufVars()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
756 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
757 call s:RestoreWinVars()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
758 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
759 " call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
760 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
761 NetrwKeepj norm! 0
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
762
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
763 if a:0 > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
764 " call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
765 if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
766 " call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
767 let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),''))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
768 " call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
769 elseif a:1 == '.'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
770 " call Decho("..case a:1<".a:1.">: matches .",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
771 let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd())
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
772 if dirname !~ '/$'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
773 let dirname= dirname."/"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
774 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
775 " call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
776 elseif a:1 =~ '\$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
777 " call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
778 let dirname= simplify(expand(a:1))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
779 " call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("<slnum>"))
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
780 elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
781 " call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
782 let dirname= simplify(a:1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
783 " call Decho("..using user-specified dirname<".dirname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
784 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
785 " call Decho("..case a:1: pattern or filepattern",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
786 let dirname= a:1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
787 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
788 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
789 " clear explore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
790 " call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
791 call s:NetrwClearExplore()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
792 " call Dret("netrw#Explore : cleared list")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
793 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
794 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
795
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
796 " call Decho("dirname<".dirname.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
797 if dirname =~ '\.\./\=$'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
798 let dirname= simplify(fnamemodify(dirname,':p:h'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
799 elseif dirname =~ '\.\.' || dirname == '.'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
800 let dirname= simplify(fnamemodify(dirname,':p'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
801 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
802 " call Decho("dirname<".dirname."> (after simplify)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
803
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
804 if dirname =~ '^\*//'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
805 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
806 " call Decho("case starpat=1: Explore *//pattern",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
807 let pattern= substitute(dirname,'^\*//\(.*\)$','\1','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
808 let starpat= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
809 " call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
810 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
811
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
812 elseif dirname =~ '^\*\*//'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
813 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
814 " call Decho("case starpat=2: Explore **//pattern",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
815 let pattern= substitute(dirname,'^\*\*//','','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
816 let starpat= 2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
817 " call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
818
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
819 elseif dirname =~ '/\*\*/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
820 " handle .../**/.../filepat
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
821 " call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
822 let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
823 if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16")))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
824 let b:netrw_curdir = prefixdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
825 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
826 let b:netrw_curdir= getcwd().'/'.prefixdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
827 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
828 let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
829 let starpat= 4
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
830 " call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
831 " call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
832
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
833 elseif dirname =~ '^\*/'
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
834 " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
835 let starpat= 3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
836 " call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
837
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
838 elseif dirname=~ '^\*\*/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
839 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
840 let starpat= 4
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
841 " call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
842
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
843 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
844 let starpat= 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
845 " call Decho("case starpat=0: default",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
846 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
847
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
848 if starpat == 0 && a:indx >= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
849 " [Explore Hexplore Vexplore Sexplore] [dirname]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
850 " call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
851 if dirname == ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
852 let dirname= curfiledir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
853 " call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
854 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
855 if dirname =~# '^scp://' || dirname =~ '^ftp://'
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
856 call netrw#Nread(2,dirname)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
857 else
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
858 if dirname == ""
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
859 let dirname= getcwd()
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
860 elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
861 " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo',
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
862 " depending on whether backslashes have been converted to forward slashes by earlier code).
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
863 if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+'
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
864 let dirname= b:netrw_curdir."/".dirname
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
865 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
866 elseif dirname !~ '^/'
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
867 let dirname= b:netrw_curdir."/".dirname
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
868 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
869 " call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
870 call netrw#LocalBrowseCheck(dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
871 " call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
872 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
873 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
874 if exists("w:netrw_bannercnt")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
875 " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner.
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
876 " If one wants to return the same place in the netrw window, use :Rex instead.
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
877 exe w:netrw_bannercnt
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
878 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
879
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
880 " call Decho("curdir<".curdir.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
881 " ---------------------------------------------------------------------
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
882 " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
883 " if has("win32") || has("win95") || has("win64") || has("win16")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
884 " NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
885 " else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
886 " NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
887 " endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
888 " ---------------------------------------------------------------------
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
889
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
890 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
891 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
892 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
893 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
894 elseif a:indx <= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
895 " Nexplore, Pexplore, Explore: handle starpat
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
896 " call Decho("case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
897 if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
898 " call Decho("..set up <s-up> and <s-down> maps",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
899 let s:didstarstar= 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
900 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
901 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
902 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
903
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
904 if has("path_extra")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
905 " call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
906 if !exists("w:netrw_explore_indx")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
907 let w:netrw_explore_indx= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
908 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
909
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
910 let indx = a:indx
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
911 " call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
912
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
913 if indx == -1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
914 " Nexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
915 " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
916 if !exists("w:netrw_explore_list") " sanity check
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
917 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
918 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
919 sil! let @* = keepregstar
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
920 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
921 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
922 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
923 " call Dret("netrw#Explore")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
924 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
925 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
926 let indx= w:netrw_explore_indx
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
927 if indx < 0 | let indx= 0 | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
928 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
929 let curfile= w:netrw_explore_list[indx]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
930 " call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
931 while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx]
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
932 let indx= indx + 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
933 " call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
934 endwhile
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
935 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
936 " call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
937
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
938 elseif indx == -2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
939 " Pexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
940 " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
941 if !exists("w:netrw_explore_list") " sanity check
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
942 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
943 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
944 sil! let @* = keepregstar
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
945 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
946 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
947 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
948 " call Dret("netrw#Explore")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
949 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
950 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
951 let indx= w:netrw_explore_indx
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
952 if indx < 0 | let indx= 0 | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
953 if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
954 let curfile= w:netrw_explore_list[indx]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
955 " call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
956 while indx >= 0 && curfile == w:netrw_explore_list[indx]
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
957 let indx= indx - 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
958 " call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
959 endwhile
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
960 if indx < 0 | let indx= 0 | endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
961 " call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
962
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
963 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
964 " Explore -- initialize
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
965 " build list of files to Explore with Nexplore/Pexplore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
966 " call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
967 NetrwKeepj keepalt call s:NetrwClearExplore()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
968 let w:netrw_explore_indx= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
969 if !exists("b:netrw_curdir")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
970 let b:netrw_curdir= getcwd()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
971 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
972 " call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
973
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
974 " switch on starpat to build the w:netrw_explore_list of files
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
975 if starpat == 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
976 " starpat=1: Explore *//pattern (current directory only search for files containing pattern)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
977 " call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
978 " call Decho("....pattern<".pattern.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
979 try
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
980 exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
981 catch /^Vim\%((\a\+)\)\=:E480/
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
982 keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
983 " call Dret("netrw#Explore : unable to find pattern<".pattern.">")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
984 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
985 endtry
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
986 let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
987 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
988
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
989 elseif starpat == 2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
990 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
991 " call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
992 " call Decho("....pattern<".pattern.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
993 try
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
994 exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
995 catch /^Vim\%((\a\+)\)\=:E480/
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
996 keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
997 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
998 if has("clipboard")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
999 sil! let @* = keepregstar
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1000 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1001 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1002 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1003 " call Dret("netrw#Explore : no files matched pattern")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1004 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1005 endtry
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1006 let s:netrw_curdir = b:netrw_curdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1007 let w:netrw_explore_list = getqflist()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1008 let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1009 if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1010
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1011 elseif starpat == 3
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1012 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1013 " call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1014 let filepat= substitute(dirname,'^\*/','','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1015 let filepat= substitute(filepat,'^[%#<]','\\&','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1016 " call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1017 " call Decho("....filepat<".filepat.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1018 let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1019 if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1020
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1021 elseif starpat == 4
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1022 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1023 " call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1024 let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n'))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1025 if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1026 endif " switch on starpat to build w:netrw_explore_list
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1027
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1028 let w:netrw_explore_listlen = len(w:netrw_explore_list)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1029 " call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1030 " call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1031
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1032 if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1033 keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1034 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1035 sil! let @* = keepregstar
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1036 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1037 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1038 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1039 " call Dret("netrw#Explore : no files matched")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1040 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1041 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1042 endif " if indx ... endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1043
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1044 " NetrwStatusLine support - for exploring support
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1045 let w:netrw_explore_indx= indx
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1046 " call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1047
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1048 " wrap the indx around, but issue a note
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1049 if indx >= w:netrw_explore_listlen || indx < 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1050 " call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1051 let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1052 let w:netrw_explore_indx= indx
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1053 keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1054 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1055
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1056 exe "let dirfile= w:netrw_explore_list[".indx."]"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1057 " call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1058 let newdir= substitute(dirfile,'/[^/]*$','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1059 " call Decho("....newdir<".newdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1060
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1061 " call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1062 call netrw#LocalBrowseCheck(newdir)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1063 if !exists("w:netrw_liststyle")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1064 let w:netrw_liststyle= g:netrw_liststyle
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1065 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1066 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1067 keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1068 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1069 keepalt NetrwKeepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1070 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1071 let w:netrw_explore_mtchcnt = indx + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1072 let w:netrw_explore_bufnr = bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1073 let w:netrw_explore_line = line(".")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1074 keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1075 " call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1076
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1077 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1078 " call Decho("..your vim does not have +path_extra",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1079 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1080 keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1081 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1082 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1083 sil! let @* = keepregstar
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1084 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1085 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1086 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1087 " call Dret("netrw#Explore : missing +path_extra")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1088 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1089 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1090
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1091 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1092 " call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1093 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1094 sil! unlet w:netrw_treedict
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1095 sil! unlet w:netrw_treetop
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1096 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1097 let newdir= dirname
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1098 if !exists("b:netrw_curdir")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1099 NetrwKeepj call netrw#LocalBrowseCheck(getcwd())
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1100 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1101 NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1102 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1103 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1104
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1105 " visual display of **/ **// */ Exploration files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1106 " call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1107 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1108 if exists("w:netrw_explore_indx") && exists("b:netrw_curdir")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1109 " call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1110 if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1111 " only update match list when current directory isn't the same as before
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1112 " call Decho("only update match list when current directory not the same as before",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1113 let s:explore_prvdir = b:netrw_curdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1114 let s:explore_match = ""
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1115 let dirlen = strlen(b:netrw_curdir)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1116 if b:netrw_curdir !~ '/$'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1117 let dirlen= dirlen + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1118 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1119 let prvfname= ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1120 for fname in w:netrw_explore_list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1121 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1122 if fname =~ '^'.b:netrw_curdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1123 if s:explore_match == ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1124 let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1125 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1126 let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1127 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1128 elseif fname !~ '^/' && fname != prvfname
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1129 if s:explore_match == ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1130 let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1131 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1132 let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1133 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1134 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1135 let prvfname= fname
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1136 endfor
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1137 " call Decho("explore_match<".s:explore_match.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1138 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1139 exe "2match netrwMarkFile /".s:explore_match."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1140 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1141 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1142 echo "<s-up>==Pexplore <s-down>==Nexplore"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1143 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1144 2match none
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1145 if exists("s:explore_match") | unlet s:explore_match | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1146 if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1147 echo " "
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1148 " call Decho("cleared explore match list",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1149 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1150
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1151 " since Explore may be used to initialize netrw's browser,
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1152 " there's no danger of a late FocusGained event on initialization.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1153 " Consequently, set s:netrw_events to 2.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1154 let s:netrw_events= 2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1155 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1156 sil! let @* = keepregstar
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1157 sil! let @+ = keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1158 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1159 sil! let @/ = keepregslash
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1160 " call Dret("netrw#Explore : @/<".@/.">")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1161 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1162
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1163 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1164 " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1165 fun! netrw#Lexplore(count,rightside,...)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1166 " call Dfunc("netrw#Lexplore(count=".a:count." rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1167 let curwin= winnr()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1168
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1169 if a:0 > 0 && a:1 != ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1170 " if a netrw window is already on the left-side of the tab
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1171 " and a directory has been specified, explore with that
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1172 " directory.
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1173 " call Decho("case has input argument(s) (a:1<".a:1.">)")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1174 let a1 = expand(a:1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1175 " call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1176 exe "1wincmd w"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1177 if &ft == "netrw"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1178 " call Decho("exe Explore ".fnameescape(a:1),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1179 exe "Explore ".fnameescape(a1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1180 exe curwin."wincmd w"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1181 if exists("t:netrw_lexposn")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1182 " call Decho("forgetting t:netrw_lexposn",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1183 unlet t:netrw_lexposn
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1184 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1185 " call Dret("netrw#Lexplore")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1186 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1187 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1188 exe curwin."wincmd w"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1189 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1190 let a1= ""
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1191 " call Decho("no input arguments")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1192 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1193
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1194 if exists("t:netrw_lexbufnr")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1195 " check if t:netrw_lexbufnr refers to a netrw window
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1196 let lexwinnr = bufwinnr(t:netrw_lexbufnr)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1197 " call Decho("lexwinnr= bufwinnr(t:netrw_lexbufnr#".t:netrw_lexbufnr.")=".lexwinnr)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1198 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1199 let lexwinnr= 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1200 " call Decho("t:netrw_lexbufnr doesn't exist")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1201 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1202 " call Decho("lexwinnr=".lexwinnr,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1203
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1204 if lexwinnr > 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1205 " close down netrw explorer window
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1206 " call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1207 exe lexwinnr."wincmd w"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1208 let g:netrw_winsize = -winwidth(0)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1209 let t:netrw_lexposn = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1210 " call Decho("saving posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1211 " call Decho("saving t:netrw_lexposn",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1212 close
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1213 if lexwinnr < curwin
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1214 let curwin= curwin - 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1215 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1216 if lexwinnr != curwin
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1217 exe curwin."wincmd w"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1218 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1219 unlet t:netrw_lexbufnr
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1220 " call Decho("unlet t:netrw_lexbufnr")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1221
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1222 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1223 " open netrw explorer window
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1224 " call Decho("t:netrw_lexbufnr<n/a>: open netrw explorer window",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1225 exe "1wincmd w"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1226 let keep_altv = g:netrw_altv
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1227 let g:netrw_altv = 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1228 if a:count != 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1229 let netrw_winsize = g:netrw_winsize
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1230 let g:netrw_winsize = a:count
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1231 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1232 let curfile= expand("%")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1233 " call Decho("curfile<".curfile.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1234 exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new"
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1235 " call Decho("new buf#".bufnr("%")." win#".winnr())
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1236 if a:0 > 0 && a1 != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1237 " call Decho("case 1: Explore ".a1,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1238 call netrw#Explore(0,0,0,a1)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1239 exe "Explore ".fnameescape(a1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1240 elseif curfile =~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1241 " call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1242 call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','',''))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1243 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1244 " call Decho("case 3: Explore .",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1245 call netrw#Explore(0,0,0,".")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1246 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1247 if a:count != 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1248 let g:netrw_winsize = netrw_winsize
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1249 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1250 setlocal winfixwidth
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1251 let g:netrw_altv = keep_altv
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1252 let t:netrw_lexbufnr = bufnr("%")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1253 " call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1254 " call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1255 if exists("t:netrw_lexposn")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1256 " call Decho("restoring to t:netrw_lexposn",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1257 " call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1258 call winrestview(t:netrw_lexposn)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1259 unlet t:netrw_lexposn
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1260 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1261 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1262
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1263 " set up default window for editing via <cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1264 if exists("g:netrw_chgwin") && g:netrw_chgwin == -1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1265 if a:rightside
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1266 let g:netrw_chgwin= 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1267 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1268 let g:netrw_chgwin= 2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1269 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1270 " call Decho("let g:netrw_chgwin=".g:netrw_chgwin)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1271 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1272
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1273 " call Dret("netrw#Lexplore")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1274 endfun
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1275
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
1276 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1277 " netrw#Clean: remove netrw {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1278 " supports :NetrwClean -- remove netrw from first directory on runtimepath
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1279 " :NetrwClean! -- remove netrw from all directories on runtimepath
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1280 fun! netrw#Clean(sys)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1281 " call Dfunc("netrw#Clean(sys=".a:sys.")")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1282
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1283 if a:sys
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1284 let choice= confirm("Remove personal and system copies of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1285 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1286 let choice= confirm("Remove personal copy of netrw?","&Yes\n&No")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1287 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1288 " call Decho("choice=".choice,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1289 let diddel= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1290 let diddir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1291
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1292 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1293 for dir in split(&rtp,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1294 if filereadable(dir."/plugin/netrwPlugin.vim")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1295 " call Decho("removing netrw-related files from ".dir,'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
1296 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
1297 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
1298 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
1299 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
1300 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
1301 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
1302 let diddir= dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1303 let diddel= diddel + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1304 if !a:sys|break|endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1305 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1306 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1307 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1308
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1309 echohl WarningMsg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1310 if diddel == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1311 echomsg "netrw is either not installed or not removable"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1312 elseif diddel == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1313 echomsg "removed one copy of netrw from <".diddir.">"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1314 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1315 echomsg "removed ".diddel." copies of netrw"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1316 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1317 echohl None
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1318
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1319 " call Dret("netrw#Clean")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1320 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1321
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1322 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1323 " netrw#MakeTgt: make a target out of the directory name provided {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1324 fun! netrw#MakeTgt(dname)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1325 " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1326 " simplify the target (eg. /abc/def/../ghi -> /abc/ghi)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1327 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1328 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1329 let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1330 " call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1331 if s:netrwmftgt_islocal
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1332 let netrwmftgt= simplify(a:dname)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1333 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1334 let netrwmftgt= a:dname
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1335 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1336 if exists("s:netrwmftgt") && netrwmftgt == s:netrwmftgt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1337 " re-selected target, so just clear it
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1338 unlet s:netrwmftgt s:netrwmftgt_islocal
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1339 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1340 let s:netrwmftgt= netrwmftgt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1341 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1342 if g:netrw_fastbrowse <= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1343 call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1344 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1345 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1346 call winrestview(svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1347 " call Dret("netrw#MakeTgt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1348 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1349
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1350 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1351 " netrw#Obtain: {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1352 " netrw#Obtain(islocal,fname[,tgtdirectory])
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1353 " islocal=0 obtain from remote source
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1354 " =1 obtain from local source
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1355 " fname : a filename or a list of filenames
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1356 " tgtdir : optional place where files are to go (not present, uses getcwd())
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1357 fun! netrw#Obtain(islocal,fname,...)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1358 " call Dfunc("netrw#Obtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1359 " NetrwStatusLine support - for obtaining support
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1360
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1361 if type(a:fname) == 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1362 let fnamelist= [ a:fname ]
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1363 elseif type(a:fname) == 3
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1364 let fnamelist= a:fname
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1365 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1366 call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1367 " call Dret("netrw#Obtain")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1368 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1369 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1370 " call Decho("fnamelist<".string(fnamelist).">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1371 if a:0 > 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1372 let tgtdir= a:1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1373 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1374 let tgtdir= getcwd()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1375 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1376 " call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1377
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1378 if exists("b:netrw_islocal") && b:netrw_islocal
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1379 " obtain a file from local b:netrw_curdir to (local) tgtdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1380 " call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1381 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1382 let topath= s:ComposePath(tgtdir,"")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1383 if (has("win32") || has("win95") || has("win64") || has("win16"))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1384 " transfer files one at time
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1385 " call Decho("transfer files one at a time",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1386 for fname in fnamelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1387 " call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1388 call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".s:ShellEscape(fname)." ".s:ShellEscape(topath))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1389 if v:shell_error != 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1390 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1391 " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1392 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1393 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1394 endfor
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1395 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1396 " transfer files with one command
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1397 " call Decho("transfer files with one command",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1398 let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1399 " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1400 call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".filelist." ".s:ShellEscape(topath))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1401 if v:shell_error != 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1402 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1403 " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1404 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1405 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1406 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1407 elseif !exists("b:netrw_curdir")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1408 call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1409 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1410 call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1411 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1412
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1413 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1414 " obtain files from remote b:netrw_curdir to local tgtdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1415 " call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1416 if type(a:fname) == 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1417 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1418 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1419 call s:NetrwMethod(b:netrw_curdir)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1420
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1421 if b:netrw_method == 4
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1422 " obtain file using scp
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1423 " call Decho("obtain via scp (method#4)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1424 if exists("g:netrw_port") && g:netrw_port != ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1425 let useport= " ".g:netrw_scpport." ".g:netrw_port
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1426 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1427 let useport= ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1428 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1429 if b:netrw_fname =~ '/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1430 let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1431 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1432 let path= ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1433 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1434 let filelist= join(map(deepcopy(fnamelist),'escape(s:ShellEscape(g:netrw_machine.":".path.v:val,1)," ")'))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1435 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1436
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1437 elseif b:netrw_method == 2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1438 " obtain file using ftp + .netrc
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1439 " call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1440 call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1441 let tmpbufnr= bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1442 setl ff=unix
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1443 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1444 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1445 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1446 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1447
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1448 if exists("b:netrw_fname") && b:netrw_fname != ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1449 call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1450 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1451 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1452
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1453 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1454 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1455 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1456 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1457 for fname in fnamelist
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1458 call setline(line("$")+1,'get "'.fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1459 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1460 endfor
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1461 if exists("g:netrw_port") && g:netrw_port != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1462 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1463 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1464 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1465 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1466 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1467 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1468 let debugkeep= &debug
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1469 setl debug=msg
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1470 call netrw#ErrorMsg(s:ERROR,getline(1),4)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1471 let &debug= debugkeep
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1472 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1473
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1474 elseif b:netrw_method == 3
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1475 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1476 " call Decho("obtain via ftp+mipf (method #3)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1477 call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1478 let tmpbufnr= bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1479 setl ff=unix
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1480
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1481 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1482 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1483 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1484 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1485 NetrwKeepj put ='open '.g:netrw_machine
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1486 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1487 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1488
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1489 if exists("g:netrw_uid") && g:netrw_uid != ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1490 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1491 NetrwKeepj put =g:netrw_uid
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1492 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1493 if exists("s:netrw_passwd") && s:netrw_passwd != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1494 NetrwKeepj put ='\"'.s:netrw_passwd.'\"'
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1495 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1496 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1497 elseif exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1498 NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1499 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1500 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1501 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1502
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1503 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1504 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1505 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1506 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1507
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1508 if exists("b:netrw_fname") && b:netrw_fname != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1509 NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1510 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1511 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1512
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1513 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1514 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1515 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1516 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1517
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1518 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1519 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1520 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1521 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1522 for fname in fnamelist
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1523 NetrwKeepj call setline(line("$")+1,'get "'.fname.'"')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1524 endfor
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1525 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1526
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1527 " perform ftp:
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1528 " -i : turns off interactive prompting from ftp
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1529 " -n unix : DON'T use <.netrc>, even though it exists
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1530 " -n win32: quit being obnoxious about password
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1531 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1532 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1533 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1534 if getline(1) !~ "^$"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1535 " call Decho("error<".getline(1).">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1536 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1537 NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1538 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1539 endif
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1540
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1541 elseif b:netrw_method == 9
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1542 " obtain file using sftp
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1543 " call Decho("obtain via sftp (method #9)",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1544 if a:fname =~ '/'
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1545 let localfile= substitute(a:fname,'^.*/','','')
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1546 else
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1547 let localfile= a:fname
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1548 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1549 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1550
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1551 elseif !exists("b:netrw_method") || b:netrw_method < 0
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1552 " probably a badly formed url; protocol not recognized
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1553 " call Dret("netrw#Obtain : unsupported method")
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1554 return
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1555
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1556 else
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1557 " protocol recognized but not supported for Obtain (yet?)
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1558 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1559 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97)
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1560 endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
1561 " call Dret("netrw#Obtain : current protocol not supported for obtaining file")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1562 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1563 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1564
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1565 " restore status line
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1566 if type(a:fname) == 1 && exists("s:netrw_users_stl")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1567 NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1568 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1569
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1570 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1571
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1572 " cleanup
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1573 if exists("tmpbufnr")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1574 if bufnr("%") != tmpbufnr
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1575 exe tmpbufnr."bw!"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1576 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1577 q!
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1578 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1579 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1580
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1581 " call Dret("netrw#Obtain")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1582 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1583
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1584 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1585 " netrw#Nread: save position, call netrw#NetRead(), and restore position {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1586 fun! netrw#Nread(mode,fname)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1587 " call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1588 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1589 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1590 call netrw#NetRead(a:mode,a:fname)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1591 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1592 call winrestview(svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1593
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1594 if exists("w:netrw_liststyle") && w:netrw_liststyle != s:TREELIST
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1595 if exists("w:netrw_bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1596 " start with cursor just after the banner
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1597 exe w:netrw_bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1598 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1599 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1600 " call Dret("netrw#Nread")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1601 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1602
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1603 " ------------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1604 " s:NetrwOptionsSave: save options prior to setting to "netrw-buffer-standard" form {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1605 " Options get restored by s:NetrwOptionsRestore()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1606 "
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1607 " Option handling:
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1608 " * save user's options (s:NetrwOptionsSave)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1609 " * set netrw-safe options (s:NetrwOptionsSafe)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1610 " - change an option only when user option != safe option (s:netrwSetSafeSetting)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1611 " * restore user's options (s:netrwOPtionsRestore)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1612 " - restore a user option when != safe option (s:NetrwRestoreSetting)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1613 " vt: (variable type) normally its either "w:" or "s:"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1614 fun! s:NetrwOptionsSave(vt)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1615 " call Dfunc("s:NetrwOptionsSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1616 " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1617 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1618
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1619 if !exists("{a:vt}netrw_optionsave")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1620 let {a:vt}netrw_optionsave= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1621 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1622 " call Dret("s:NetrwOptionsSave : options already saved")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1623 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1624 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1625 " call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1626
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1627 " Save current settings and current directory
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1628 " call Decho("saving current settings and current directory",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1629 let s:yykeep = @@
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1630 if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1631 let {a:vt}netrw_aikeep = &l:ai
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1632 let {a:vt}netrw_awkeep = &l:aw
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1633 let {a:vt}netrw_bhkeep = &l:bh
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1634 let {a:vt}netrw_blkeep = &l:bl
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1635 let {a:vt}netrw_btkeep = &l:bt
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1636 let {a:vt}netrw_bombkeep = &l:bomb
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1637 let {a:vt}netrw_cedit = &cedit
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1638 let {a:vt}netrw_cikeep = &l:ci
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1639 let {a:vt}netrw_cinkeep = &l:cin
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1640 let {a:vt}netrw_cinokeep = &l:cino
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1641 let {a:vt}netrw_comkeep = &l:com
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1642 let {a:vt}netrw_cpokeep = &l:cpo
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1643 let {a:vt}netrw_diffkeep = &l:diff
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1644 let {a:vt}netrw_fenkeep = &l:fen
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1645 " call Decho("saving current settings: got here#1",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1646 if !exists("g:netrw_ffkeep") || g:netrw_ffkeep
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1647 let {a:vt}netrw_ffkeep = &l:ff
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1648 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1649 let {a:vt}netrw_fokeep = &l:fo " formatoptions
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1650 let {a:vt}netrw_gdkeep = &l:gd " gdefault
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1651 let {a:vt}netrw_hidkeep = &l:hidden
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1652 let {a:vt}netrw_imkeep = &l:im
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1653 let {a:vt}netrw_iskkeep = &l:isk
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1654 let {a:vt}netrw_lskeep = &l:ls
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1655 let {a:vt}netrw_makeep = &l:ma
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1656 let {a:vt}netrw_magickeep = &l:magic
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1657 let {a:vt}netrw_modkeep = &l:mod
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1658 let {a:vt}netrw_nukeep = &l:nu
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1659 let {a:vt}netrw_rnukeep = &l:rnu
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1660 let {a:vt}netrw_repkeep = &l:report
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1661 let {a:vt}netrw_rokeep = &l:ro
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1662 let {a:vt}netrw_selkeep = &l:sel
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1663 let {a:vt}netrw_spellkeep = &l:spell
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1664 " call Decho("saving current settings: got here#2",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1665 if !g:netrw_use_noswf
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1666 let {a:vt}netrw_swfkeep = &l:swf
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1667 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1668 let {a:vt}netrw_tskeep = &l:ts
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1669 let {a:vt}netrw_twkeep = &l:tw " textwidth
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1670 let {a:vt}netrw_wigkeep = &l:wig " wildignore
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1671 let {a:vt}netrw_wrapkeep = &l:wrap
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1672 let {a:vt}netrw_writekeep = &l:write
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1673
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1674 " save a few selected netrw-related variables
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1675 " call Decho("saving a few selected netrw-related variables",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1676 if g:netrw_keepdir
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1677 let {a:vt}netrw_dirkeep = getcwd()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1678 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1679 if has("clipboard")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1680 sil! let {a:vt}netrw_starkeep = @*
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1681 sil! let {a:vt}netrw_pluskeep = @+
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1682 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1683 sil! let {a:vt}netrw_slashkeep= @/
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1684
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1685 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1686 " call Dret("s:NetrwOptionsSave : tab#".tabpagenr()." win#".winnr())
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1687 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1688
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1689 " ---------------------------------------------------------------------
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1690 " s:NetrwOptionsSafe: sets options to help netrw do its job {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1691 " Use s:NetrwSaveOptions() to save user settings
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1692 " Use s:NetrwOptionsRestore() to restore user settings
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1693 fun! s:NetrwOptionsSafe(islocal)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1694 " call Dfunc("s:NetrwOptionsSafe(islocal=".a:islocal.") win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1695 " call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1696 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1697 if exists("+acd") | call s:NetrwSetSafeSetting("&l:acd",0)|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1698 call s:NetrwSetSafeSetting("&l:ai",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1699 call s:NetrwSetSafeSetting("&l:aw",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1700 call s:NetrwSetSafeSetting("&l:bl",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1701 call s:NetrwSetSafeSetting("&l:bomb",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1702 if a:islocal
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1703 call s:NetrwSetSafeSetting("&l:bt","nofile")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1704 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1705 call s:NetrwSetSafeSetting("&l:bt","acwrite")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1706 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1707 call s:NetrwSetSafeSetting("&l:ci",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1708 call s:NetrwSetSafeSetting("&l:cin",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1709 call s:NetrwSetSafeSetting("&l:bh","hide")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1710 call s:NetrwSetSafeSetting("&l:cino","")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1711 call s:NetrwSetSafeSetting("&l:com","")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1712 if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1713 if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1714 setl fo=nroql2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1715 call s:NetrwSetSafeSetting("&l:hid",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1716 call s:NetrwSetSafeSetting("&l:im",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1717 setl isk+=@ isk+=* isk+=/
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1718 call s:NetrwSetSafeSetting("&l:magic",1)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1719 if g:netrw_use_noswf
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1720 call s:NetrwSetSafeSetting("swf",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1721 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1722 call s:NetrwSetSafeSetting("&l:report",10000)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1723 call s:NetrwSetSafeSetting("&l:sel","inclusive")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1724 call s:NetrwSetSafeSetting("&l:spell",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1725 call s:NetrwSetSafeSetting("&l:tw",0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1726 call s:NetrwSetSafeSetting("&l:wig","")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1727 setl cedit&
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1728 call s:NetrwCursor()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1729
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1730 " allow the user to override safe options
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1731 " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1732 if &ft == "netrw"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1733 " call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1734 keepalt NetrwKeepj doau FileType netrw
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1735 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1736
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1737 " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1738 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1739 " call Dret("s:NetrwOptionsSafe")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1740 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1741
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1742 " ---------------------------------------------------------------------
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1743 " s:NetrwOptionsRestore: restore options (based on prior s:NetrwOptionsSave) {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1744 fun! s:NetrwOptionsRestore(vt)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1745 " call Dfunc("s:NetrwOptionsRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1746 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1747 if !exists("{a:vt}netrw_optionsave")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1748 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1749 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1750 " call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1751 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1752 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1753 unlet {a:vt}netrw_optionsave
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1754
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1755 if exists("+acd")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1756 if exists("{a:vt}netrw_acdkeep")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1757 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1758 let curdir = getcwd()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1759 let &l:acd = {a:vt}netrw_acdkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1760 unlet {a:vt}netrw_acdkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1761 if &l:acd
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1762 call s:NetrwLcd(curdir)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1763 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1764 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1765 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1766 call s:NetrwRestoreSetting(a:vt."netrw_aikeep","&l:ai")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1767 call s:NetrwRestoreSetting(a:vt."netrw_awkeep","&l:aw")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1768 call s:NetrwRestoreSetting(a:vt."netrw_blkeep","&l:bl")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1769 call s:NetrwRestoreSetting(a:vt."netrw_btkeep","&l:bt")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1770 call s:NetrwRestoreSetting(a:vt."netrw_bombkeep","&l:bomb")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1771 call s:NetrwRestoreSetting(a:vt."netrw_cedit","&cedit")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1772 call s:NetrwRestoreSetting(a:vt."netrw_cikeep","&l:ci")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1773 call s:NetrwRestoreSetting(a:vt."netrw_cinkeep","&l:cin")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1774 call s:NetrwRestoreSetting(a:vt."netrw_cinokeep","&l:cino")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1775 call s:NetrwRestoreSetting(a:vt."netrw_comkeep","&l:com")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1776 call s:NetrwRestoreSetting(a:vt."netrw_cpokeep","&l:cpo")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1777 call s:NetrwRestoreSetting(a:vt."netrw_diffkeep","&l:diff")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1778 call s:NetrwRestoreSetting(a:vt."netrw_fenkeep","&l:fen")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1779 if exists("g:netrw_ffkeep") && g:netrw_ffkeep
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1780 call s:NetrwRestoreSetting(a:vt."netrw_ffkeep")","&l:ff")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1781 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1782 call s:NetrwRestoreSetting(a:vt."netrw_fokeep","&l:fo")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1783 call s:NetrwRestoreSetting(a:vt."netrw_gdkeep","&l:gd")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1784 call s:NetrwRestoreSetting(a:vt."netrw_hidkeep","&l:hidden")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1785 call s:NetrwRestoreSetting(a:vt."netrw_imkeep","&l:im")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1786 call s:NetrwRestoreSetting(a:vt."netrw_iskkeep","&l:isk")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1787 call s:NetrwRestoreSetting(a:vt."netrw_lskeep","&l:ls")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1788 call s:NetrwRestoreSetting(a:vt."netrw_makeep","&l:ma")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1789 call s:NetrwRestoreSetting(a:vt."netrw_magickeep","&l:magic")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1790 call s:NetrwRestoreSetting(a:vt."netrw_modkeep","&l:mod")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1791 call s:NetrwRestoreSetting(a:vt."netrw_nukeep","&l:nu")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1792 call s:NetrwRestoreSetting(a:vt."netrw_rnukeep","&l:rnu")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1793 call s:NetrwRestoreSetting(a:vt."netrw_repkeep","&l:report")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1794 call s:NetrwRestoreSetting(a:vt."netrw_rokeep","&l:ro")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1795 call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1796 call s:NetrwRestoreSetting(a:vt."netrw_spellkeep","&l:spell")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1797 call s:NetrwRestoreSetting(a:vt."netrw_twkeep","&l:tw")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1798 call s:NetrwRestoreSetting(a:vt."netrw_wigkeep","&l:wig")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1799 call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep","&l:wrap")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1800 call s:NetrwRestoreSetting(a:vt."netrw_writekeep","&l:write")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1801 call s:NetrwRestoreSetting("s:yykeep","@@")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1802 " former problem: start with liststyle=0; press <i> : result, following line resets l:ts.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1803 " Fixed; in s:PerformListing, when w:netrw_liststyle is s:LONGLIST, will use a printf to pad filename with spaces
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1804 " rather than by appending a tab which previously was using "&ts" to set the desired spacing. (Sep 28, 2018)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1805 call s:NetrwRestoreSetting(a:vt."netrw_tskeep","&l:ts")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1806
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1807 if exists("{a:vt}netrw_swfkeep")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1808 if &directory == ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1809 " user hasn't specified a swapfile directory;
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1810 " netrw will temporarily set the swapfile directory
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1811 " to the current directory as returned by getcwd().
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1812 let &l:directory= getcwd()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1813 sil! let &l:swf = {a:vt}netrw_swfkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1814 setl directory=
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1815 unlet {a:vt}netrw_swfkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1816 elseif &l:swf != {a:vt}netrw_swfkeep
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1817 if !g:netrw_use_noswf
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1818 " following line causes a Press ENTER in windows -- can't seem to work around it!!!
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1819 sil! let &l:swf= {a:vt}netrw_swfkeep
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
1820 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1821 unlet {a:vt}netrw_swfkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1822 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1823 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1824 if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1825 let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1826 if exists("{a:vt}netrw_dirkeep")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1827 call s:NetrwLcd(dirkeep)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1828 unlet {a:vt}netrw_dirkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1829 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1830 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1831 if has("clipboard")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1832 call s:NetrwRestoreSetting(a:vt."netrw_starkeep","@*")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1833 call s:NetrwRestoreSetting(a:vt."netrw_pluskeep","@+")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1834 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1835 call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1836
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1837 " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1838 " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1839 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1840 " call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1841 " call Decho("ts=".&l:ts,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1842 " Moved the filetype detect here from NetrwGetFile() because remote files
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1843 " were having their filetype detect-generated settings overwritten by
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1844 " NetrwOptionRestore.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1845 if &ft != "netrw"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1846 " call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1847 filetype detect
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1848 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1849 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1850 " call Dret("s:NetrwOptionsRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1851 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1852
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1853 " ---------------------------------------------------------------------
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1854 " s:NetrwSetSafeSetting: sets an option to a safe setting {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1855 " but only when the options' value and the safe setting differ
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1856 " Doing this means that netrw will not come up as having changed a
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1857 " setting last when it really didn't actually change it.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1858 "
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1859 " Called from s:NetrwOptionsSafe
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1860 " ex. call s:NetrwSetSafeSetting("&l:sel","inclusive")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1861 fun! s:NetrwSetSafeSetting(setting,safesetting)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1862 " call Dfunc("s:NetrwSetSafeSetting(setting<".a:setting."> safesetting<".a:safesetting.">)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1863
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1864 if a:setting =~ '^&'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1865 " call Decho("fyi: a:setting starts with &")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1866 exe "let settingval= ".a:setting
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1867 " call Decho("fyi: settingval<".settingval.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1868
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1869 if settingval != a:safesetting
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1870 " call Decho("set setting<".a:setting."> to option value<".a:safesetting.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1871 if type(a:safesetting) == 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1872 exe "let ".a:setting."=".a:safesetting
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1873 elseif type(a:safesetting) == 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1874 exe "let ".a:setting."= '".a:safesetting."'"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1875 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1876 call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:setting." with a safesetting of type#".type(a:safesetting),105)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1877 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1878 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1879 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1880
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1881 " call Dret("s:NetrwSetSafeSetting")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1882 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1883
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
1884 " ------------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1885 " s:NetrwRestoreSetting: restores specified setting using associated keepvar, {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1886 " but only if the setting value differs from the associated keepvar.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1887 " Doing this means that netrw will not come up as having changed a
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1888 " setting last when it really didn't actually change it.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1889 "
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1890 " Used by s:NetrwOptionsRestore() to restore each netrw-senstive setting
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1891 " keepvars are set up by s:NetrwOptionsSave
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1892 fun! s:NetrwRestoreSetting(keepvar,setting)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1893 "" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1894
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1895 " typically called from s:NetrwOptionsRestore
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1896 " call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1897 " ex. call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1898 " Restores option (if different) from a keepvar
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1899 if exists(a:keepvar)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1900 exe "let keepvarval= ".a:keepvar
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1901 exe "let setting= ".a:setting
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1902
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1903 "" call Decho("fyi: a:keepvar<".a:keepvar."> exists")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1904 "" call Decho("fyi: keepvarval=".keepvarval)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1905 "" call Decho("fyi: a:setting<".a:setting."> setting<".setting.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1906
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1907 if setting != keepvarval
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1908 "" call Decho("restore setting<".a:setting."=".setting."> to keepvarval<".keepvarval.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1909 if type(a:setting) == 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1910 exe "let ".a:setting."= ".keepvarval
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1911 elseif type(a:setting) == 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1912 exe "let ".a:setting."= '".keepvarval."'"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1913 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1914 call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1915 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1916 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1917
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1918 exe "unlet ".a:keepvar
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1919 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1920
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1921 "" call Dret("s:NetrwRestoreSetting")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1922 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1923
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1924 " ---------------------------------------------------------------------
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1925 " NetrwStatusLine: {{{2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1926 fun! NetrwStatusLine()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1927
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1928 " vvv NetrwStatusLine() debugging vvv
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1929 " let g:stlmsg=""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1930 " if !exists("w:netrw_explore_bufnr")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1931 " let g:stlmsg="!X<explore_bufnr>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1932 " elseif w:netrw_explore_bufnr != bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1933 " let g:stlmsg="explore_bufnr!=".bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1934 " endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1935 " if !exists("w:netrw_explore_line")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1936 " let g:stlmsg=" !X<explore_line>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1937 " elseif w:netrw_explore_line != line(".")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1938 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1939 " endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1940 " if !exists("w:netrw_explore_list")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1941 " let g:stlmsg=" !X<explore_list>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1942 " endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1943 " ^^^ NetrwStatusLine() debugging ^^^
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1944
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1945 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")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1946 " restore user's status line
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1947 let &stl = s:netrw_users_stl
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1948 let &laststatus = s:netrw_users_ls
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1949 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1950 if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1951 return ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1952 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1953 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1954 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1955 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
1956
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1957 " ===============================
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1958 " Netrw Transfer Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1959 " ===============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1960
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1961 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
1962 " netrw#NetRead: responsible for reading a file over the net {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1963 " mode: =0 read remote file and insert before current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1964 " =1 read remote file and insert after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1965 " =2 replace with remote file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1966 " =3 obtain file, but leave in temporary format
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1967 fun! netrw#NetRead(mode,...)
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
1968 " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : ""))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1969
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1970 " NetRead: save options {{{3
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1971 call s:NetrwOptionsSave("w:")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1972 call s:NetrwOptionsSafe(0)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
1973 call s:RestoreCursorline()
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1974 " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1975 " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
1976 setl bl
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
1977 " call Decho("buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1978
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1979 " NetRead: interpret mode into a readcmd {{{3
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1980 if a:mode == 0 " read remote file before current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1981 let readcmd = "0r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1982 elseif a:mode == 1 " read file after current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1983 let readcmd = "r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1984 elseif a:mode == 2 " replace with remote file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1985 let readcmd = "%r"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1986 elseif a:mode == 3 " skip read of file (leave as temporary)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1987 let readcmd = "t"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1988 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1989 exe a:mode
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1990 let readcmd = "r"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1991 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1992 let ichoice = (a:0 == 0)? 0 : 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
1993 " call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1994
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
1995 " NetRead: get temporary filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1996 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1997 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
1998 " call Dret("netrw#NetRead : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1999 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2000 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2001
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2002 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2003
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2004 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2005 if exists("b:netrw_lastfile") && a:0 == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2006 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2007 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2008 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2009
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2010 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2011 exe "let choice= a:" . ichoice
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2012 " call Decho("no lastfile: choice<" . choice . ">",'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2013
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2014 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2015 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2016 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2017 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2018 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2019 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2020 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2021 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2022 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2023 echomsg ':Nread http://[user@]machine/path uses http wget'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2024 echomsg ':Nread file:///path uses elinks'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2025 echomsg ':Nread https://[user@]machine/path uses http wget'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2026 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2027 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2028 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2029 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2030 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2031 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2032
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2033 elseif match(choice,'^"') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2034 " Reconstruct Choice if choice starts with '"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2035 " call Decho("reconstructing choice",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2036 if match(choice,'"$') != -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2037 " case "..."
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2038 let choice= strpart(choice,1,strlen(choice)-2)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2039 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2040 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2041 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2042 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2043
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2044 while match(choice,'"$') == -1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2045 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2046 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2047 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2048 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2049 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",3)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2050 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2051 " call Dret("netrw#NetRead :2 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2052 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2053 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2054 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2055 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2056 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2057 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2058 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2059 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2060
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2061 " call Decho("choice<" . choice . ">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2062 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2063
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2064 " NetRead: Determine method of read (ftp, rcp, etc) {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2065 call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2066 if !exists("b:netrw_method") || b:netrw_method < 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2067 " call Dret("netrw#NetRead : unsupported method")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2068 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2069 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2070 let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2071
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2072 " Check whether or not NetrwBrowse() should be handling this request
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2073 " call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2074 if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2075 " call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2076 NetrwKeepj call s:NetrwBrowse(0,choice)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2077 " call Dret("netrw#NetRead :3 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2078 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2079 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2080
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2081 " ============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2082 " NetRead: Perform Protocol-Based Read {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2083 " ===========================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2084 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2085 echo "(netrw) Processing your read request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2086 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2087
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2088 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2089 " NetRead: (rcp) NetRead Method #1 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2090 if b:netrw_method == 1 " read with rcp
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2091 " call Decho("read via rcp (method #1)",'~'.expand("<slnum>"))
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2092 " ER: nothing done with g:netrw_uid yet?
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2093 " ER: on Win2K" rcp machine[.user]:file tmpfile
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2094 " ER: when machine contains '.' adding .user is required (use $USERNAME)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2095 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2096 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2097 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2098 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2099 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2100 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2101 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2102 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2103 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2104 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2105 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2106 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2107 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2108 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2109 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2110 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2111 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2112 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2113
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2114 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2115 " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2116 elseif b:netrw_method == 2 " read with ftp + <.netrc>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2117 " call Decho("read via ftp+.netrc (method #2)",'~'.expand("<slnum>"))
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
2118 let netrw_fname= b:netrw_fname
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2119 NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2120 let filtbuf= bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2121 setl ff=unix
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2122 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2123 " call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2124 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2125 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2126 " call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2127 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2128 call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2129 " call Decho("filter input: ".getline(line("$")),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2130 if exists("g:netrw_port") && g:netrw_port != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2131 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2132 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2133 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2134 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2135 " 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
2136 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2137 let debugkeep = &debug
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2138 setl debug=msg
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2139 NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),4)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2140 let &debug = debugkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2141 endif
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
2142 call s:SaveBufVars()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2143 keepj bd!
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2144 if bufname("%") == "" && getline("$") == "" && line('$') == 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2145 " 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
2146 q!
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
2147 endif
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
2148 call s:RestoreBufVars()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2149 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2150 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2151
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2152 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2153 " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2154 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2155 " Construct execution string (four lines) which will be passed through filter
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2156 " call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2157 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2158 NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars()
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2159 let filtbuf= bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2160 setl ff=unix
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2161 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2162 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2163 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2164 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2165 NetrwKeepj put ='open '.g:netrw_machine
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2166 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2167 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2168
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2169 if exists("g:netrw_uid") && g:netrw_uid != ""
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2170 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2171 NetrwKeepj put =g:netrw_uid
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2172 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2173 if exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2174 NetrwKeepj put ='\"'.s:netrw_passwd.'\"'
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2175 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2176 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2177 elseif exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2178 NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2179 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2180 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2181 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2182
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2183 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2184 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2185 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2186 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2187 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2188 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2189 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2190 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2191 NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2192 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2193
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2194 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2195 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2196 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2197 " -n win32: quit being obnoxious about password
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2198 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2199 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2200 " 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
2201 if getline(1) !~ "^$"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2202 " call Decho("error<".getline(1).">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2203 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2204 call netrw#ErrorMsg(s:ERROR,getline(1),5)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2205 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2206 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2207 call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2208 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2209 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2210
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2211 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2212 " NetRead: (scp) NetRead Method #4 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2213 elseif b:netrw_method == 4 " read with scp
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2214 " call Decho("read via scp (method #4)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2215 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
2216 let useport= " ".g:netrw_scpport." ".g:netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2217 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2218 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2219 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2220 " 'C' in 'C:\path\to\file' is handled as hostname on windows.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2221 " This is workaround to avoid mis-handle windows local-path:
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2222 if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2223 let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2224 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2225 let tmpfile_get = tmpfile
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2226 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2227 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".escape(s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1),' ')." ".s:ShellEscape(tmpfile_get,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2228 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2229 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2230
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2231 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2232 " NetRead: (http) NetRead Method #5 (wget) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2233 elseif b:netrw_method == 5
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2234 " call Decho("read via http (method #5)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2235 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2236 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2237 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
2238 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2239 " call Dret("netrw#NetRead :4 getcwd<".getcwd().">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2240 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2241 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2242
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2243 if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2244 " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2245 " call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("<slnum>"))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2246 if exists("g:netrw_http_xcmd")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2247 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2248 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2249 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2250 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2251 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2252
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2253 else
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2254 " wget/curl/fetch plus a jump to an in-page marker (ie. http://abc/def.html#aMarker)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2255 " call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2256 let netrw_html= substitute(b:netrw_fname,"#.*$","","")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2257 let netrw_tag = substitute(b:netrw_fname,"^.*#","","")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2258 " call Decho("netrw_html<".netrw_html.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2259 " call Decho("netrw_tag <".netrw_tag.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2260 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2261 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2262 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2263 exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2264 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2265 let b:netrw_lastfile = choice
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2266 " call Decho("setl ro",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
2267 setl ro nomod
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2268
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2269 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2270 " NetRead: (dav) NetRead Method #6 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2271 elseif b:netrw_method == 6
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2272 " call Decho("read via cadaver (method #6)",'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2273
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2274 if !executable(g:netrw_dav_cmd)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2275 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
2276 " call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2277 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2278 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2279 if g:netrw_dav_cmd =~ "curl"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2280 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".s:ShellEscape("dav://".g:netrw_machine.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2281 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2282 " Construct execution string (four lines) which will be passed through filter
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2283 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2284 new
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2285 setl ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2286 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2287 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2288 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2289 NetrwKeepj put ='open '.g:netrw_machine
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2290 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2291 if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2292 NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2293 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2294 NetrwKeepj put ='get '.netrw_fname.' '.tmpfile
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2295 NetrwKeepj put ='quit'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2296
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2297 " perform cadaver operation:
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2298 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2299 call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2300 keepj bd!
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2301 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2302 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2303 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2304
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2305 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2306 " NetRead: (rsync) NetRead Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2307 elseif b:netrw_method == 7
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2308 " call Decho("read via rsync (method #7)",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2309 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2310 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2311 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2312
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2313 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2314 " NetRead: (fetch) NetRead Method #8 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2315 " fetch://[user@]host[:http]/path
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2316 elseif b:netrw_method == 8
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2317 " call Decho("read via fetch (method #8)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2318 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2319 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2320 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2321 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2322 " call Dret("NetRead")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2323 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2324 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2325 if exists("g:netrw_option") && g:netrw_option =~ ":https\="
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2326 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2327 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2328 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2329 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2330 " call Decho("read via fetch for ".netrw_option,'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2331
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2332 if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2333 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s: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
2334 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2335 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2336 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2337
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2338 let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2339 let b:netrw_lastfile = choice
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2340 " call Decho("setl ro",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
2341 setl ro nomod
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2342
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2343 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2344 " NetRead: (sftp) NetRead Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2345 elseif b:netrw_method == 9
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2346 " call Decho("read via sftp (method #9)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2347 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2348 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2349 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2350
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2351 ".........................................
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2352 " NetRead: (file) NetRead Method #10 {{{3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2353 elseif b:netrw_method == 10 && exists("g:netrw_file_cmd")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2354 " " call Decho("read via ".b:netrw_file_cmd." (method #10)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2355 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".s:ShellEscape(b:netrw_fname,1)." ".tmpfile)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2356 let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2357 let b:netrw_lastfile = choice
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2358
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2359 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2360 " NetRead: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2361 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2362 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2363 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2364 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2365
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2366 " NetRead: cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2367 if exists("b:netrw_method")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2368 " call Decho("cleanup b:netrw_method and b:netrw_fname",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2369 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2370 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2371 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2372 if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2373 " call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2374 NetrwKeepj call s:NetrwDelete(tmpfile)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2375 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2376 NetrwKeepj call s:NetrwOptionsRestore("w:")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2377
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2378 " call Dret("netrw#NetRead :5 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2379 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2380
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2381 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2382 " netrw#NetWrite: responsible for writing a file over the net {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2383 fun! netrw#NetWrite(...) range
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2384 " call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2385
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2386 " NetWrite: option handling {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2387 let mod= 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2388 call s:NetrwOptionsSave("w:")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2389 call s:NetrwOptionsSafe(0)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2390
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2391 " NetWrite: Get Temporary Filename {{{3
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2392 let tmpfile= s:GetTempfile("")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2393 if tmpfile == ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2394 " call Dret("netrw#NetWrite : unable to get a tempfile!")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2395 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2396 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2397
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2398 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2399 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2400 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2401 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2402 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2403
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2404 let curbufname= expand("%")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2405 " call Decho("curbufname<".curbufname.">",'~'.expand("<slnum>"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2406 if &binary
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2407 " For binary writes, always write entire file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2408 " (line numbers don't really make sense for that).
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2409 " Also supports the writing of tar and zip files.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2410 " call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2411 exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2412 elseif g:netrw_cygwin
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2413 " write (selected portion of) file to temporary
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2414 let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2415 " call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2416 exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2417 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2418 " write (selected portion of) file to temporary
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2419 " call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2420 exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2421 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2422
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2423 if curbufname == ""
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2424 " when the file is [No Name], and one attempts to Nwrite it, the buffer takes
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2425 " on the temporary file's name. Deletion of the temporary file during
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2426 " cleanup then causes an error message.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2427 0file!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2428 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2429
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2430 " NetWrite: while choice loop: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2431 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2432
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2433 " Process arguments: {{{4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2434 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2435 if exists("b:netrw_lastfile") && a:0 == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2436 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2437 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2438 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2439 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2440 exe "let choice= a:" . ichoice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2441
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2442 " Reconstruct Choice when choice starts with '"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2443 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2444 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2445 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2446 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2447 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2448 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2449 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2450 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2451 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2452 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2453 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2454 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2455 sleep 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2456 break
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2457
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2458 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2459 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2460 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2461 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2462 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2463 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2464 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2465 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2466
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2467 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2468 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2469 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2470 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2471 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2472 call netrw#ErrorMsg(s:ERROR,"Unbalanced string in filename '". wholechoice ."'",13)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2473 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2474 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2475 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2476 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2477 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2478 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2479 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2480 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2481 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2482 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2483 let ichoice= ichoice + 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2484 " call Decho("choice<" . choice . "> ichoice=".ichoice,'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2485
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2486 " Determine method of write (ftp, rcp, etc) {{{4
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2487 NetrwKeepj call s:NetrwMethod(choice)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2488 if !exists("b:netrw_method") || b:netrw_method < 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2489 " call Dfunc("netrw#NetWrite : unsupported method")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2490 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2491 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2492
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2493 " =============
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2494 " NetWrite: Perform Protocol-Based Write {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2495 " ============================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2496 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2497 echo "(netrw) Processing your write request..."
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2498 " call Decho("Processing your write request...",'~'.expand("<slnum>"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2499 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2500
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2501 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2502 " NetWrite: (rcp) NetWrite Method #1 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2503 if b:netrw_method == 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2504 " call Decho("write via rcp (method #1)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2505 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2506 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2507 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2508 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2509 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2510 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2511 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2512 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2513 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2514 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2515 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2516 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2517 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2518 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2519 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2520
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2521 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2522 " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2523 elseif b:netrw_method == 2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2524 " call Decho("write via ftp+.netrc (method #2)",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2525 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2526
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2527 " 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
2528 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2529 let curbuf = bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2530 setl bh=hide
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2531 keepj keepalt enew
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2532
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2533 " call Decho("filter input window#".winnr(),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2534 setl ff=unix
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2535 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2536 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2537 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2538 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2539 " call Decho("filter input: ".getline("$"),'~'.expand("<slnum>"))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2540 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2541 NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2542 " call Decho("filter input: ".getline("$"),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2543 if exists("g:netrw_port") && g:netrw_port != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2544 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2545 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2546 " call Decho("filter input window#".winnr(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2547 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2548 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2549 " 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
2550 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2551 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2552 NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),14)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2553 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2554 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2555 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2556
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2557 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2558 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2559 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2560 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2561 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2562
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2563 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2564
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2565 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2566 " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2567 elseif b:netrw_method == 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2568 " Construct execution string (three or more lines) which will be passed through filter
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2569 " call Decho("read via ftp+mipf (method #3)",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2570 let netrw_fname = b:netrw_fname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2571 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2572
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2573 " 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
2574 let curbuf = bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2575 setl bh=hide
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2576 keepj keepalt enew
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2577 setl ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2578
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2579 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2580 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2581 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2582 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2583 NetrwKeepj put ='open '.g:netrw_machine
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2584 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2585 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2586 if exists("g:netrw_uid") && g:netrw_uid != ""
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2587 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2588 NetrwKeepj put =g:netrw_uid
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2589 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2590 if exists("s:netrw_passwd") && s:netrw_passwd != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2591 NetrwKeepj put ='\"'.s:netrw_passwd.'\"'
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2592 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2593 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2594 elseif exists("s:netrw_passwd") && s:netrw_passwd != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2595 NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2596 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2597 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2598 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2599 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2600 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2601 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2602 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2603 " call Decho("filter input: ".getline("$"),'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2604 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2605 NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2606 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2607 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2608 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2609
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2610 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2611 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2612 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2613 " -n win32: quit being obnoxious about password
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2614 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2615 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2616 " 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
2617 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2618 if !exists("g:netrw_quiet")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2619 call netrw#ErrorMsg(s:ERROR,getline(1),15)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2620 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2621 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2622 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2623
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2624 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2625 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2626 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2627 let &l:bh= bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2628 exe filtbuf."bw!"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2629
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2630 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2631 " NetWrite: (scp) NetWrite Method #4 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2632 elseif b:netrw_method == 4
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2633 " call Decho("write via scp (method #4)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2634 if exists("g:netrw_port") && g:netrw_port != ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2635 let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2636 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2637 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2638 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2639 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2640 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2641
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2642 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2643 " NetWrite: (http) NetWrite Method #5 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2644 elseif b:netrw_method == 5
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2645 " call Decho("write via http (method #5)",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2646 let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2647 if executable(curl)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2648 let url= g:netrw_choice
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2649 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) )
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2650 elseif !exists("g:netrw_quiet")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2651 call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd.">".",16)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2652 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2653
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2654 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2655 " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2656 elseif b:netrw_method == 6
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2657 " call Decho("write via cadaver (method #6)",'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2658
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2659 " 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
2660 let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2661 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2662
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2663 " 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
2664 let curbuf = bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2665 setl bh=hide
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2666 keepj keepalt enew
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2667
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2668 setl ff=unix
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2669 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2670 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2671 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2672 NetrwKeepj put ='open '.g:netrw_machine
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2673 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2674 if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2675 NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2676 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2677 NetrwKeepj put ='put '.tmpfile.' '.netrw_fname
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2678
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2679 " perform cadaver operation:
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2680 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2681 call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2682
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2683 " remove enew buffer (quietly)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2684 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2685 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2686 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2687 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2688
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2689 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2690
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2691 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2692 " NetWrite: (rsync) NetWrite Method #7 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2693 elseif b:netrw_method == 7
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2694 " call Decho("write via rsync (method #7)",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2695 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2696 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2697
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2698 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2699 " NetWrite: (sftp) NetWrite Method #9 {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2700 elseif b:netrw_method == 9
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2701 " call Decho("write via sftp (method #9)",'~'.expand("<slnum>"))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2702 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2703 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2704 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2705 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2706 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2707 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2708
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2709 " 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
2710 let bhkeep = &l:bh
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2711 let curbuf = bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2712 setl bh=hide
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2713 keepj keepalt enew
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2714
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
2715 setl ff=unix
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2716 call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2717 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2718 let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2719 call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.s:ShellEscape(uid_machine,1))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2720 let filtbuf= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2721 exe curbuf."b!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2722 let &l:bh = bhkeep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2723 exe filtbuf."bw!"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2724 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2725
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2726 ".........................................
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2727 " NetWrite: Complain {{{3
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2728 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2729 call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2730 let leavemod= 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2731 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2732 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2733
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2734 " NetWrite: Cleanup: {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2735 " call Decho("cleanup",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2736 if s:FileReadable(tmpfile)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2737 " call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
2738 call s:NetrwDelete(tmpfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2739 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2740 call s:NetrwOptionsRestore("w:")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2741
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2742 if a:firstline == 1 && a:lastline == line("$")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2743 " restore modifiability; usually equivalent to set nomod
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2744 let &mod= mod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2745 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2746 elseif !exists("leavemod")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2747 " indicate that the buffer has not been modified since last written
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2748 " call Decho("set nomod",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2749 setl nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2750 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2751 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2752
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2753 " call Dret("netrw#NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2754 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2755
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2756 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2757 " netrw#NetSource: source a remotely hosted vim script {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2758 " uses NetRead to get a copy of the file into a temporarily file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2759 " then sources that file,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2760 " then removes that file.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2761 fun! netrw#NetSource(...)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2762 " call Dfunc("netrw#NetSource() a:0=".a:0)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2763 if a:0 > 0 && a:1 == '?'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2764 " give help
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2765 echomsg 'NetSource Usage:'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2766 echomsg ':Nsource dav://machine[:port]/path uses cadaver'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2767 echomsg ':Nsource fetch://machine/path uses fetch'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2768 echomsg ':Nsource ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
2769 echomsg ':Nsource http[s]://[user@]machine/path uses http wget'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2770 echomsg ':Nsource rcp://[user@]machine/path uses rcp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2771 echomsg ':Nsource rsync://machine[:port]/path uses rsync'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2772 echomsg ':Nsource scp://[user@]machine[[:#]port]/path uses scp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2773 echomsg ':Nsource sftp://[user@]machine[[:#]port]/path uses sftp'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2774 sleep 4
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2775 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2776 let i= 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2777 while i <= a:0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2778 call netrw#NetRead(3,a:{i})
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2779 " call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2780 if s:FileReadable(s:netrw_tmpfile)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2781 " call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("<slnum>"))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
2782 exe "so ".fnameescape(s:netrw_tmpfile)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2783 " call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
2784 if delete(s:netrw_tmpfile)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
2785 call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".s:netrw_tmpfile.">!",103)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
2786 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2787 unlet s:netrw_tmpfile
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2788 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2789 call netrw#ErrorMsg(s:ERROR,"unable to source <".a:{i}.">!",48)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2790 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2791 let i= i + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2792 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2793 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2794 " call Dret("netrw#NetSource")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2795 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2796
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2797 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2798 " netrw#SetTreetop: resets the tree top to the current directory/specified directory {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2799 " (implements the :Ntree command)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2800 fun! netrw#SetTreetop(iscmd,...)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2801 " call Dfunc("netrw#SetTreetop(iscmd=".a:iscmd." ".((a:0 > 0)? a:1 : "").") a:0=".a:0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2802 " call Decho("w:netrw_treetop<".w:netrw_treetop.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2803
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2804 " iscmd==0: netrw#SetTreetop called using gn mapping
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2805 " iscmd==1: netrw#SetTreetop called using :Ntree from the command line
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2806 " call Decho("(iscmd=".a:iscmd.": called using :Ntree from command line",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2807 " clear out the current tree
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2808 if exists("w:netrw_treetop")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2809 " call Decho("clearing out current tree",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2810 let inittreetop= w:netrw_treetop
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2811 unlet w:netrw_treetop
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2812 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2813 if exists("w:netrw_treedict")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2814 " call Decho("freeing w:netrw_treedict",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2815 unlet w:netrw_treedict
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2816 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2817 " call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2818
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2819 if (a:iscmd == 0 || a:1 == "") && exists("inittreetop")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2820 let treedir= s:NetrwTreePath(inittreetop)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2821 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2822 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2823 if isdirectory(s:NetrwFile(a:1))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2824 " call Decho("a:1<".a:1."> is a directory",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2825 let treedir= a:1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2826 elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://')
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2827 let treedir= b:netrw_curdir."/".a:1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2828 " call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2829 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2830 " normally the cursor is left in the message window.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2831 " However, here this results in the directory being listed in the message window, which is not wanted.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2832 let netrwbuf= bufnr("%")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2833 call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2834 exe bufwinnr(netrwbuf)."wincmd w"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2835 let treedir= "."
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2836 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2837 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2838 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2839
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2840 " determine if treedir is remote or local
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2841 let islocal= expand("%") !~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2842 " call Decho("islocal=".islocal,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2843
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2844 " browse the resulting directory
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2845 if islocal
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2846 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2847 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2848 call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,treedir))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2849 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2850
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
2851 " call Dret("netrw#SetTreetop")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2852 endfun
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2853
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2854 " ===========================================
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2855 " s:NetrwGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2856 " readcmd == %r : replace buffer with newly read file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2857 " == 0r : read file at top of buffer
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2858 " == r : read file after current line
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2859 " == t : leave file in temporary form (ie. don't read into buffer)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2860 fun! s:NetrwGetFile(readcmd, tfile, method)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2861 " call Dfunc("NetrwGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2862
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2863 " readcmd=='t': simply do nothing
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2864 if a:readcmd == 't'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2865 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2866 " call Dret("NetrwGetFile : skip read of <".a:tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2867 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2868 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2869
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2870 " get name of remote filename (ie. url and all)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2871 let rfile= bufname("%")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2872 " call Decho("rfile<".rfile.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2873
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2874 if exists("*NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2875 " for the use of NetReadFixup (not otherwise used internally)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2876 let line2= line("$")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2877 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2878
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2879 if a:readcmd[0] == '%'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2880 " get file into buffer
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2881 " call Decho("get file into buffer",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2882
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2883 " rename the current buffer to the temp file (ie. tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2884 if g:netrw_cygwin
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2885 let tfile= substitute(a:tfile,g:netrw_cygdrive.'/\(.\)','\1:','')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2886 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2887 let tfile= a:tfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2888 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2889 call s:NetrwBufRename(tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2890
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2891 " edit temporary file (ie. read the temporary file in)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2892 if rfile =~ '\.zip$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2893 " call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2894 call zip#Browse(tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2895 elseif rfile =~ '\.tar$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2896 " call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2897 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2898 elseif rfile =~ '\.tar\.gz$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2899 " call Decho("handling remote gzip-compressed tar file",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2900 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2901 elseif rfile =~ '\.tar\.bz2$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2902 " call Decho("handling remote bz2-compressed tar file",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2903 call tar#Browse(tfile)
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2904 elseif rfile =~ '\.tar\.xz$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2905 " call Decho("handling remote xz-compressed tar file",'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2906 call tar#Browse(tfile)
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2907 elseif rfile =~ '\.txz$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2908 " call Decho("handling remote xz-compressed tar file (.txz)",'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
2909 call tar#Browse(tfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2910 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2911 " call Decho("edit temporary file",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2912 NetrwKeepj e!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2913 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2914
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2915 " rename buffer back to remote filename
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2916 call s:NetrwBufRename(rfile)
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2917
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2918 " Detect filetype of local version of remote file.
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2919 " Note that isk must not include a "/" for scripts.vim
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
2920 " to process this detection correctly.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2921 " call Decho("detect filetype of local version of remote file",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2922 let iskkeep= &l:isk
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2923 setl isk-=/
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
2924 let &l:isk= iskkeep
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2925 " call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2926 let line1 = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2927 let line2 = line("$")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2928
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2929 elseif !&ma
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2930 " attempting to read a file after the current line in the file, but the buffer is not modifiable
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2931 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2932 " call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2933 return
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
2934
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2935 elseif s:FileReadable(a:tfile)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2936 " read file after current line
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2937 " call Decho("read file<".a:tfile."> after current line",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2938 let curline = line(".")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2939 let lastline= line("$")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2940 " call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2941 exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2942 let line1= curline + 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2943 let line2= line("$") - lastline + 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2944
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2945 else
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2946 " not readable
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2947 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2948 " call Decho("tfile<".a:tfile."> not readable",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2949 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2950 " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2951 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2952 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2953
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2954 " User-provided (ie. optional) fix-it-up command
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2955 if exists("*NetReadFixup")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2956 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2957 NetrwKeepj call NetReadFixup(a:method, line1, line2)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2958 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2959 " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")",'~'.expand("<slnum>"))
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2960 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2961
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
2962 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
2963 " update the Buffers menu
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2964 NetrwKeepj call s:UpdateBuffersMenu()
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2965 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2966
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2967 " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile),'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2968
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2969 " make sure file is being displayed
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2970 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2971
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2972 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2973 " call Dret("NetrwGetFile")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2974 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2975
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
2976 " ------------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
2977 " s:NetrwMethod: determine method of transfer {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2978 " Input:
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2979 " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2980 " Output:
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2981 " b:netrw_method= 1: rcp
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2982 " 2: ftp + <.netrc>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2983 " 3: ftp + machine, id, password, and [path]filename
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2984 " 4: scp
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2985 " 5: http[s] (wget)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2986 " 6: dav
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2987 " 7: rsync
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2988 " 8: fetch
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
2989 " 9: sftp
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
2990 " 10: file
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2991 " g:netrw_machine= hostname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2992 " b:netrw_fname = filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2993 " g:netrw_port = optional port number (for ftp)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2994 " g:netrw_choice = copy of input url (choice)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
2995 fun! s:NetrwMethod(choice)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
2996 " call Dfunc("s:NetrwMethod(a:choice<".a:choice.">)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2997
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
2998 " sanity check: choice should have at least three slashes in it
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
2999 if strlen(substitute(a:choice,'[^/]','','g')) < 3
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
3000 call netrw#ErrorMsg(s:ERROR,"not a netrw-style url; netrw uses protocol://[user@]hostname[:port]/[path])",78)
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
3001 let b:netrw_method = -1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3002 " call Dret("s:NetrwMethod : incorrect url format<".a:choice.">")
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
3003 return
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
3004 endif
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
3005
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3006 " record current g:netrw_machine, if any
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3007 " curmachine used if protocol == ftp and no .netrc
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3008 if exists("g:netrw_machine")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3009 let curmachine= g:netrw_machine
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3010 " call Decho("curmachine<".curmachine.">",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3011 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3012 let curmachine= "N O T A HOST"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3013 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3014 if exists("g:netrw_port")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3015 let netrw_port= g:netrw_port
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3016 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3017
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3018 " insure that netrw_ftp_cmd starts off every method determination
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3019 " with the current g:netrw_ftp_cmd
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3020 let s:netrw_ftp_cmd= g:netrw_ftp_cmd
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3021
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3022 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3023 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3024 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3025 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3026 let g:netrw_port = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3027 let g:netrw_choice = a:choice
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3028
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3029 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3030 " mipf : a:machine a:id password filename Use ftp
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3031 " 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
3032 " 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
3033 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3034 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3035 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3036 " httpurm : http[s]://[user@]host/filename Use wget
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3037 " davurm : dav[s]://host[:port]/path Use cadaver/curl
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3038 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3039 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3040 " sftpurm : sftp://[user@]host/filename Use scp
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3041 " fileurm : file://[user@]host/filename Use elinks or links
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3042 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3043 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3044 let ftpurm = '^ftp://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3045 let rcpurm = '^rcp://\%(\([^/]*\)@\)\=\([^/]\{-}\)/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3046 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3047 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3048 let httpurm = '^https\=://\([^/]\{-}\)\(/.*\)\=$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3049 let davurm = '^davs\=://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3050 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3051 let fetchurm = '^fetch://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3052 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3053 let fileurm = '^file\=://\(.*\)$'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3054
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3055 " call Decho("determine method:",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3056 " Determine Method
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3057 " Method#1: rcp://user@hostname/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3058 if match(a:choice,rcpurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3059 " call Decho("rcp://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3060 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3061 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3062 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3063 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3064 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3065 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3066 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3067
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3068 " Method#4: scp://user@hostname/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3069 elseif match(a:choice,scpurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3070 " call Decho("scp://...",'~'.expand("<slnum>"))
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3071 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3072 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3073 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3074 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3075
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3076 " Method#5: http[s]://user@hostname/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3077 elseif match(a:choice,httpurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3078 " call Decho("http[s]://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3079 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3080 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3081 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3082 let b:netrw_http = (a:choice =~ '^https:')? "https" : "http"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3083
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3084 " Method#6: dav://hostname[:port]/..path-to-file.. {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3085 elseif match(a:choice,davurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3086 " call Decho("dav://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3087 let b:netrw_method= 6
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3088 if a:choice =~ 'davs:'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3089 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3090 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3091 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3092 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3093 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3094
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3095 " Method#7: rsync://user@hostname/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3096 elseif match(a:choice,rsyncurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3097 " call Decho("rsync://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3098 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3099 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3100 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3101
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3102 " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3103 elseif match(a:choice,ftpurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3104 " call Decho("ftp://...",'~'.expand("<slnum>"))
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3105 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3106 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3107 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3108 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3109 " call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3110 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3111 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3112 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3113
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3114 if curmachine != g:netrw_machine
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3115 if exists("s:netrw_hup[".g:netrw_machine."]")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3116 call NetUserPass("ftp:".g:netrw_machine)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3117 elseif exists("s:netrw_passwd")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3118 " if there's a change in hostname, require password re-entry
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3119 unlet s:netrw_passwd
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3120 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3121 if exists("netrw_port")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3122 unlet netrw_port
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3123 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3124 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3125
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3126 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3127 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3128 else
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3129 let host= substitute(g:netrw_machine,'\..*$','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3130 if exists("s:netrw_hup[host]")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3131 call NetUserPass("ftp:".host)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3132
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
3133 elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~# '-[sS]:'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3134 " call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3135 " call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
3136 if g:netrw_ftp_cmd =~# '-[sS]:\S*MACHINE\>'
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
3137 let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\<MACHINE\>',g:netrw_machine,'')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3138 " call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3139 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3140 let b:netrw_method= 2
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3141 elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3142 " call Decho("using <".expand("$HOME/.netrc")."> (readable)",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3143 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3144 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3145 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3146 call NetUserPass()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3147 elseif !exists("s:netrw_passwd") || s:netrw_passwd == ""
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3148 call NetUserPass(g:netrw_uid)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3149 " else just use current g:netrw_uid and s:netrw_passwd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3150 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3151 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3152 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3153 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3154
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3155 " Method#8: fetch {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3156 elseif match(a:choice,fetchurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3157 " call Decho("fetch://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3158 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3159 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3160 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3161 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3162 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3163
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3164 " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3165 elseif match(a:choice,mipf) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3166 " call Decho("(ftp) host id pass file",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3167 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3168 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3169 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3170 let s:netrw_passwd = substitute(a:choice,mipf,'\3',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3171 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3172 call NetUserPass(g:netrw_machine,g:netrw_uid,s:netrw_passwd)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3173
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3174 " Method#3: Issue an ftp: "hostname [path/]filename" {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3175 elseif match(a:choice,mf) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3176 " call Decho("(ftp) host file",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3177 if exists("g:netrw_uid") && exists("s:netrw_passwd")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3178 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3179 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3180 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3181
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3182 elseif s:FileReadable(expand("$HOME/.netrc"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3183 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3184 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3185 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3186 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3187
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3188 " Method#9: sftp://user@hostname/...path-to-file {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3189 elseif match(a:choice,sftpurm) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3190 " call Decho("sftp://...",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3191 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3192 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3193 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3194
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3195 " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3196 elseif match(a:choice,rcphf) == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3197 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3198 let b:netrw_method = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3199 let userid = substitute(a:choice,rcphf,'\2',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3200 let g:netrw_machine = substitute(a:choice,rcphf,'\3',"")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3201 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3202 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3203 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3204 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3205 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3206 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3207 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3208 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3209
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3210 " Method#10: file://user@hostname/...path-to-file {{{3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3211 elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3212 " call Decho("http[s]://...",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3213 let b:netrw_method = 10
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3214 let b:netrw_fname = substitute(a:choice,fileurm,'\1',"")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3215 " call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3216
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3217 " Cannot Determine Method {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3218 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3219 if !exists("g:netrw_quiet")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3220 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
3221 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3222 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3223 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3224 "}}}3
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3225
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3226 if g:netrw_port != ""
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3227 " remove any leading [:#] from port number
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3228 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3229 elseif exists("netrw_port")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3230 " retain port number as implicit for subsequent ftp operations
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3231 let g:netrw_port= netrw_port
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3232 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3233
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3234 " call Decho("a:choice <".a:choice.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3235 " call Decho("b:netrw_method <".b:netrw_method.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3236 " call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3237 " call Decho("g:netrw_port <".g:netrw_port.">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3238 " if exists("g:netrw_uid") "Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3239 " call Decho("g:netrw_uid <".g:netrw_uid.">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3240 " endif "Decho
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3241 " if exists("s:netrw_passwd") "Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3242 " call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3243 " endif "Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3244 " call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3245 " call Dret("s:NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3246 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3247
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3248 " ------------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3249 " NetReadFixup: this sort of function is typically written by the user {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3250 " to handle extra junk that their system's ftp dumps
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3251 " into the transfer. This function is provided as an
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3252 " example and as a fix for a Windows 95 problem: in my
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3253 " experience, win95's ftp always dumped four blank lines
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3254 " at the end of the transfer.
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3255 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3256 fun! NetReadFixup(method, line1, line2)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3257 " 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
3258
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3259 " sanity checks -- attempt to convert inputs to integers
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3260 let method = a:method + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3261 let line1 = a:line1 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3262 let line2 = a:line2 + 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3263 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
3264 " call Dret("NetReadFixup")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3265 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3266 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3267
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3268 if method == 3 " ftp (no <.netrc>)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3269 let fourblanklines= line2 - 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3270 if fourblanklines >= line1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3271 exe "sil NetrwKeepj ".fourblanklines.",".line2."g/^\s*$/d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3272 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3273 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3274 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3275
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3276 " call Dret("NetReadFixup")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3277 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3278 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3279
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3280 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3281 " NetUserPass: set username and password for subsequent ftp transfer {{{2
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3282 " Usage: :call NetUserPass() -- will prompt for userid and password
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3283 " :call NetUserPass("uid") -- will prompt for password
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3284 " :call NetUserPass("uid","password") -- sets global userid and password
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3285 " :call NetUserPass("ftp:host") -- looks up userid and password using hup dictionary
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3286 " :call NetUserPass("host","uid","password") -- sets hup dictionary with host, userid, password
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3287 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3288
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3289 " call Dfunc("NetUserPass() a:0=".a:0)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3290
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3291 if !exists('s:netrw_hup')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3292 let s:netrw_hup= {}
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3293 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3294
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3295 if a:0 == 0
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3296 " case: no input arguments
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3297
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3298 " change host and username if not previously entered; get new password
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3299 if !exists("g:netrw_machine")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3300 let g:netrw_machine= input('Enter hostname: ')
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3301 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3302 if !exists("g:netrw_uid") || g:netrw_uid == ""
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3303 " get username (user-id) via prompt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3304 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3305 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3306 " get password via prompting
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3307 let s:netrw_passwd= inputsecret("Enter Password: ")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3308
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3309 " set up hup database
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3310 let host = substitute(g:netrw_machine,'\..*$','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3311 if !exists('s:netrw_hup[host]')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3312 let s:netrw_hup[host]= {}
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3313 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3314 let s:netrw_hup[host].uid = g:netrw_uid
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3315 let s:netrw_hup[host].passwd = s:netrw_passwd
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3316
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3317 elseif a:0 == 1
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3318 " case: one input argument
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3319
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3320 if a:1 =~ '^ftp:'
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3321 " get host from ftp:... url
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3322 " access userid and password from hup (host-user-passwd) dictionary
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3323 " call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3324 let host = substitute(a:1,'^ftp:','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3325 let host = substitute(host,'\..*','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3326 if exists("s:netrw_hup[host]")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3327 let g:netrw_uid = s:netrw_hup[host].uid
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3328 let s:netrw_passwd = s:netrw_hup[host].passwd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3329 " call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3330 " call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3331 else
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3332 let g:netrw_uid = input("Enter UserId: ")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3333 let s:netrw_passwd = inputsecret("Enter Password: ")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3334 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3335
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3336 else
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3337 " case: one input argument, not an url. Using it as a new user-id.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3338 " call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3339 if exists("g:netrw_machine")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3340 if g:netrw_machine =~ '[0-9.]\+'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3341 let host= g:netrw_machine
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3342 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3343 let host= substitute(g:netrw_machine,'\..*$','','')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3344 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3345 else
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3346 let g:netrw_machine= input('Enter hostname: ')
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3347 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3348 let g:netrw_uid = a:1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3349 " call Decho("set g:netrw_uid= <".g:netrw_uid.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3350 if exists("g:netrw_passwd")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3351 " ask for password if one not previously entered
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3352 let s:netrw_passwd= g:netrw_passwd
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3353 else
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3354 let s:netrw_passwd = inputsecret("Enter Password: ")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3355 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3356 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3357
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3358 " call Decho("host<".host.">",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3359 if exists("host")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3360 if !exists('s:netrw_hup[host]')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3361 let s:netrw_hup[host]= {}
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3362 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3363 let s:netrw_hup[host].uid = g:netrw_uid
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3364 let s:netrw_hup[host].passwd = s:netrw_passwd
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3365 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3366
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3367 elseif a:0 == 2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3368 let g:netrw_uid = a:1
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3369 let s:netrw_passwd = a:2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3370
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3371 elseif a:0 == 3
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3372 " enter hostname, user-id, and password into the hup dictionary
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3373 let host = substitute(a:1,'^\a\+:','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3374 let host = substitute(host,'\..*$','','')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3375 if !exists('s:netrw_hup[host]')
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3376 let s:netrw_hup[host]= {}
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3377 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3378 let s:netrw_hup[host].uid = a:2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3379 let s:netrw_hup[host].passwd = a:3
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3380 let g:netrw_uid = s:netrw_hup[host].uid
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3381 let s:netrw_passwd = s:netrw_hup[host].passwd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3382 " call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3383 " call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("<slnum>"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3384 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3385
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3386 " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3387 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3388
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3389 " =================================
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3390 " Shared Browsing Support: {{{1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3391 " =================================
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3392
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3393 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3394 " s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3395 fun! s:ExplorePatHls(pattern)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3396 " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3397 let repat= substitute(a:pattern,'^**/\{1,2}','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3398 " call Decho("repat<".repat.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3399 let repat= escape(repat,'][.\')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3400 " call Decho("repat<".repat.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3401 let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3402 " call Dret("s:ExplorePatHls repat<".repat.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3403 return repat
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3404 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3405
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3406 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3407 " s:NetrwBookHistHandler: {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3408 " 0: (user: <mb>) bookmark current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3409 " 1: (user: <gb>) change to the bookmarked directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3410 " 2: (user: <qb>) list bookmarks
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3411 " 3: (browsing) records current directory history
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3412 " 4: (user: <u>) go up (previous) directory, using history
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3413 " 5: (user: <U>) go down (next) directory, using history
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3414 " 6: (user: <mB>) delete bookmark
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3415 fun! s:NetrwBookHistHandler(chg,curdir)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3416 " call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhistcnt." histmax=".g:netrw_dirhistmax)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3417 if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3418 " " call Dret("s:NetrwBookHistHandler - suppressed due to g:netrw_dirhistmax")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3419 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3420 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3421
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3422 let ykeep = @@
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3423 let curbufnr = bufnr("%")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3424
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3425 if a:chg == 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3426 " bookmark the current directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3427 " call Decho("(user: <b>) bookmark the current directory",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3428 if exists("s:netrwmarkfilelist_{curbufnr}")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3429 call s:NetrwBookmark(0)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3430 echo "bookmarked marked files"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3431 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3432 call s:MakeBookmark(a:curdir)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3433 echo "bookmarked the current directory"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3434 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3435
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3436 elseif a:chg == 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3437 " change to the bookmarked directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3438 " call Decho("(user: <".v:count."gb>) change to the bookmarked directory",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3439 if exists("g:netrw_bookmarklist[v:count-1]")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3440 " call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3441 exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1])
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3442 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3443 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3444 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3445
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3446 elseif a:chg == 2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3447 " redraw!
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3448 let didwork= 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3449 " list user's bookmarks
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3450 " call Decho("(user: <q>) list user's bookmarks",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3451 if exists("g:netrw_bookmarklist")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3452 " call Decho('list '.len(g:netrw_bookmarklist).' bookmarks','~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3453 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3454 for bmd in g:netrw_bookmarklist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3455 " call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1],'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3456 echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1])
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3457 let didwork = 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3458 let cnt = cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3459 endfor
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3460 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3461
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3462 " list directory history
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3463 " Note: history is saved only when PerformListing is done;
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3464 " ie. when netrw can re-use a netrw buffer, the current directory is not saved in the history.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3465 let cnt = g:netrw_dirhistcnt
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3466 let first = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3467 let histcnt = 0
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3468 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3469 while ( first || cnt != g:netrw_dirhistcnt )
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3470 " call Decho("first=".first." cnt=".cnt." dirhistcnt=".g:netrw_dirhistcnt,'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3471 if exists("g:netrw_dirhist_{cnt}")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3472 " call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3473 echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt})
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3474 let didwork= 1
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3475 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3476 let histcnt = histcnt + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3477 let first = 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3478 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3479 if cnt < 0
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3480 let cnt= cnt + g:netrw_dirhistmax
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3481 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3482 endwhile
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3483 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3484 let g:netrw_dirhistcnt= 0
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3485 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3486 if didwork
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3487 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3488 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3489
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3490 elseif a:chg == 3
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3491 " saves most recently visited directories (when they differ)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3492 " call Decho("(browsing) record curdir history",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3493 if !exists("g:netrw_dirhistcnt") || !exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") || g:netrw_dirhist_{g:netrw_dirhistcnt} != a:curdir
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3494 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3495 let g:netrw_dirhistcnt = ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3496 let g:netrw_dirhist_{g:netrw_dirhistcnt} = a:curdir
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3497 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3498 " call Decho("save dirhist#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3499 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3500
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3501 elseif a:chg == 4
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3502 " u: change to the previous directory stored on the history list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3503 " call Decho("(user: <u>) chg to prev dir from history",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3504 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3505 let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - v:count1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3506 if g:netrw_dirhistcnt < 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3507 let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3508 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3509 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3510 let g:netrw_dirhistcnt= 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3511 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3512 if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3513 " call Decho("changedir u#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3514 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3515 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3516 " call Decho("setl ma noro",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3517 sil! NetrwKeepj %d _
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3518 setl nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3519 " call Decho("setl nomod",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3520 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3521 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3522 " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3523 exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt})
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3524 else
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3525 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3526 let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + v:count1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3527 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3528 let g:netrw_dirhistcnt= 0
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3529 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3530 echo "Sorry, no predecessor directory exists yet"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3531 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3532
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3533 elseif a:chg == 5
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3534 " U: change to the subsequent directory stored on the history list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3535 " call Decho("(user: <U>) chg to next dir from history",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3536 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3537 let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3538 if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3539 " call Decho("changedir U#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3540 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3541 " call Decho("setl ma noro",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3542 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3543 sil! NetrwKeepj %d _
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3544 " call Decho("removed all lines from buffer (%d)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3545 " call Decho("setl nomod",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3546 setl nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3547 " call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3548 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3549 " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3550 exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt})
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3551 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3552 let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - 1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3553 if g:netrw_dirhistcnt < 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3554 let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3555 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3556 echo "Sorry, no successor directory exists yet"
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3557 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3558 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3559 let g:netrw_dirhistcnt= 0
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3560 echo "Sorry, no successor directory exists yet (g:netrw_dirhistmax is ".g:netrw_dirhistmax.")"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
3561 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3562
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3563 elseif a:chg == 6
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3564 " call Decho("(user: <mB>) delete bookmark'd directory",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3565 if exists("s:netrwmarkfilelist_{curbufnr}")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3566 call s:NetrwBookmark(1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3567 echo "removed marked files from bookmarks"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3568 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3569 " delete the v:count'th bookmark
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3570 let iremove = v:count
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3571 let dremove = g:netrw_bookmarklist[iremove - 1]
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3572 " call Decho("delete bookmark#".iremove."<".g:netrw_bookmarklist[iremove - 1].">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3573 call s:MergeBookmarks()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3574 " call Decho("remove g:netrw_bookmarklist[".(iremove-1)."]<".g:netrw_bookmarklist[(iremove-1)].">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3575 NetrwKeepj call remove(g:netrw_bookmarklist,iremove-1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3576 echo "removed ".dremove." from g:netrw_bookmarklist"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3577 " call Decho("g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3578 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3579 " call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3580 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3581 call s:NetrwBookmarkMenu()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3582 call s:NetrwTgtMenu()
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3583 let @@= ykeep
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
3584 " call Dret("s:NetrwBookHistHandler")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3585 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3586
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3587 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3588 " s:NetrwBookHistRead: this function reads bookmarks and history {{{2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3589 " Will source the history file (.netrwhist) only if the g:netrw_disthistmax is > 0.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3590 " Sister function: s:NetrwBookHistSave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3591 fun! s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3592 " call Dfunc("s:NetrwBookHistRead()")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3593 if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3594 " call Dret("s:NetrwBookHistRead - nothing read (suppressed due to dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a").")")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3595 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3596 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3597 let ykeep= @@
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3598
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3599 " read bookmarks
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3600 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3601 let home = s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3602 let savefile= home."/.netrwbook"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3603 if filereadable(s:NetrwFile(savefile))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3604 " call Decho("sourcing .netrwbook",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3605 exe "keepalt NetrwKeepj so ".savefile
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3606 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3607
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3608 " read history
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3609 if g:netrw_dirhistmax > 0
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3610 let savefile= home."/.netrwhist"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3611 if filereadable(s:NetrwFile(savefile))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3612 " call Decho("sourcing .netrwhist",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3613 exe "keepalt NetrwKeepj so ".savefile
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3614 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3615 let s:netrw_initbookhist= 1
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3616 au VimLeave * call s:NetrwBookHistSave()
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3617 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3618 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3619
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3620 let @@= ykeep
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3621 " call Decho("dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3622 " call Decho("dirhistcnt=".(exists("g:netrw_dirhistcnt")? g:netrw_dirhistcnt : "n/a"),'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3623 " call Dret("s:NetrwBookHistRead")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3624 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3625
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3626 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3627 " s:NetrwBookHistSave: this function saves bookmarks and history to files {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3628 " Sister function: s:NetrwBookHistRead()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3629 " I used to do this via viminfo but that appears to
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3630 " be unreliable for long-term storage
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3631 " If g:netrw_dirhistmax is <= 0, no history or bookmarks
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3632 " will be saved.
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3633 " (s:NetrwBookHistHandler(3,...) used to record history)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3634 fun! s:NetrwBookHistSave()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3635 " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3636 if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3637 " call Dret("s:NetrwBookHistSave : nothing saved (dirhistmax=".g:netrw_dirhistmax.")")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3638 return
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3639 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3640
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3641 let savefile= s:NetrwHome()."/.netrwhist"
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3642 " call Decho("savefile<".savefile.">",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3643 1split
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3644 call s:NetrwEnew()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3645 " call Decho("case g:netrw_use_noswf=".g:netrw_use_noswf.(exists("+acd")? " +acd" : " -acd"),'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3646 if g:netrw_use_noswf
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3647 setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3648 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3649 setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3650 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3651 setl nocin noai noci magic nospell nohid wig= noaw
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3652 setl ma noro write
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3653 if exists("+acd") | setl noacd | endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3654 sil! NetrwKeepj keepalt %d _
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3655
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3656 " rename enew'd file: .netrwhist -- no attempt to merge
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3657 " record dirhistmax and current dirhistcnt
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3658 " save history
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3659 " call Decho("saving history: dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt." lastline=".line("$"),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3660 sil! keepalt file .netrwhist
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3661 call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3662 call setline(2,"let g:netrw_dirhistcnt =".g:netrw_dirhistcnt)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3663 if g:netrw_dirhistmax > 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3664 let lastline = line("$")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3665 let cnt = g:netrw_dirhistcnt
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3666 let first = 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3667 while ( first || cnt != g:netrw_dirhistcnt )
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3668 let lastline= lastline + 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3669 if exists("g:netrw_dirhist_{cnt}")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3670 call setline(lastline,'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3671 " call Decho("..".lastline.'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3672 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3673 let first = 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3674 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3675 if cnt < 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3676 let cnt= cnt + g:netrw_dirhistmax
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3677 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3678 endwhile
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3679 exe "sil! w! ".savefile
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3680 " call Decho("exe sil! w! ".savefile,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3681 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3682
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3683 " save bookmarks
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3684 sil NetrwKeepj %d _
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3685 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != []
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3686 " call Decho("saving bookmarks",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3687 " merge and write .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3688 let savefile= s:NetrwHome()."/.netrwbook"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3689
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3690 if filereadable(s:NetrwFile(savefile))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3691 let booklist= deepcopy(g:netrw_bookmarklist)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3692 exe "sil NetrwKeepj keepalt so ".savefile
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3693 for bdm in booklist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3694 if index(g:netrw_bookmarklist,bdm) == -1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3695 call add(g:netrw_bookmarklist,bdm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3696 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3697 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3698 call sort(g:netrw_bookmarklist)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3699 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3700
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3701 " construct and save .netrwbook
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3702 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
3703 exe "sil! w! ".savefile
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3704 " call Decho("exe sil! w! ".savefile,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3705 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3706
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3707 " cleanup -- remove buffer used to construct history
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3708 let bgone= bufnr("%")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3709 q!
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3710 exe "keepalt ".bgone."bwipe!"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3711
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3712 " call Dret("s:NetrwBookHistSave")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3713 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3714
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3715 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3716 " 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
3717 " 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
3718 " 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
3719 " with the requested remote hostname first.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3720 " Often called via: Explore/e dirname/etc -> netrw#LocalBrowseCheck() -> s:NetrwBrowse()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3721 fun! s:NetrwBrowse(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3722 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
3723 " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr())
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3724 " call Decho("fyi: modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3725 " call Decho("fyi: tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3726 " call Dredir("ls!","s:NetrwBrowse")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3727
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3728 " save alternate-file's filename if w:netrw_rexlocal doesn't exist
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3729 " This is useful when one edits a local file, then :e ., then :Rex
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3730 if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3731 let w:netrw_rexfile= bufname("#")
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
3732 " call Decho("setting w:netrw_rexfile<".w:netrw_rexfile."> win#".winnr(),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3733 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3734
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3735 " s:NetrwBrowse : initialize history {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3736 if !exists("s:netrw_initbookhist")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3737 NetrwKeepj call s:NetrwBookHistRead()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3738 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3739
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3740 " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3741 if a:dirname !~ '^\a\{3,}://'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3742 let dirname= simplify(a:dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3743 " call Decho("simplified dirname<".dirname.">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3744 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3745 let dirname= a:dirname
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3746 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3747
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3748 " repoint t:netrw_lexbufnr if appropriate
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3749 if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3750 " call Decho("set repointlexbufnr to true!")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3751 let repointlexbufnr= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3752 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3753
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3754 " s:NetrwBrowse : sanity checks: {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3755 if exists("s:netrw_skipbrowse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3756 unlet s:netrw_skipbrowse
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3757 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3758 " call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3759 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3760 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3761 if !exists("*shellescape")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3762 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3763 " call Dret("s:NetrwBrowse : missing shellescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3764 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3765 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3766 if !exists("*fnameescape")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3767 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3768 " call Dret("s:NetrwBrowse : missing fnameescape()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3769 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3770 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3771
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3772 " s:NetrwBrowse : save options: {{{3
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3773 call s:NetrwOptionsSave("w:")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3774
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3775 " s:NetrwBrowse : re-instate any marked files {{{3
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3776 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3777 if exists("s:netrwmarkfilelist_{bufnr('%')}")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3778 " call Decho("clearing marked files",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3779 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3780 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3781 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3782
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3783 if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3784 " s:NetrwBrowse : set up "safe" options for local directory/file {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3785 " call Decho("handle w:netrw_acdkeep:",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3786 " call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3787 if s:NetrwLcd(dirname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3788 " call Dret("s:NetrwBrowse : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3789 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3790 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3791 " call s:NetrwOptionsSafe() " tst952 failed with this enabled.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3792 " call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3793
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3794 elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3795 " s:NetrwBrowse : remote regular file handler {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3796 " call Decho("handle remote regular file: dirname<".dirname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3797 if bufname(dirname) != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3798 " call Decho("edit buf#".bufname(dirname)." in win#".winnr(),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3799 exe "NetrwKeepj b ".bufname(dirname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3800 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3801 " attempt transfer of remote regular file
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3802 " call Decho("attempt transfer as regular file<".dirname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3803
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3804 " remove any filetype indicator from end of dirname, except for the
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3805 " "this is a directory" indicator (/).
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3806 " There shouldn't be one of those here, anyway.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3807 let path= substitute(dirname,'[*=@|]\r\=$','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3808 " call Decho("new path<".path.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3809 call s:RemotePathAnalysis(dirname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3810
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3811 " s:NetrwBrowse : remote-read the requested file into current buffer {{{3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3812 call s:NetrwEnew(dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3813 call s:NetrwOptionsSafe(a:islocal)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3814 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3815 " call Decho("setl ma noro",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3816 let b:netrw_curdir = dirname
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3817 let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3818 call s:NetrwBufRename(url)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3819 exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3820 sil call netrw#NetRead(2,url)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3821 " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3822 " call Decho("url<".url.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3823 " call Decho("s:path<".s:path.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3824 " call Decho("s:fname<".s:fname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3825 if s:path =~ '.bz2'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3826 exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','',''))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3827 elseif s:path =~ '.gz'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3828 exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','',''))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3829 elseif s:path =~ '.gz'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3830 exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','',''))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3831 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3832 exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(s:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3833 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3834 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3835
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3836 " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3837 call s:SetBufWinVars()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3838 call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3839 " call Decho("setl ma nomod",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3840 setl ma nomod noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3841 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3842
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3843 " call Dret("s:NetrwBrowse : file<".s:fname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3844 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3845 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3846
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3847 " use buffer-oriented WinVars if buffer variables exist but associated window variables don't {{{3
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3848 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3849
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3850 " set up some variables {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3851 let b:netrw_browser_active = 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3852 let dirname = dirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3853 let s:last_sort_by = g:netrw_sort_by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3854
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3855 " set up menu {{{3
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3856 NetrwKeepj call s:NetrwMenu(1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3857
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3858 " get/set-up buffer {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3859 " call Decho("saving position across a buffer refresh",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3860 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3861 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3862 let reusing= s:NetrwGetBuffer(a:islocal,dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3863
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3864 " maintain markfile highlighting
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3865 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3866 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3867 " " call Decho("bufnr(%)=".bufnr('%'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3868 " " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3869 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3870 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3871 " " call Decho("2match none",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3872 2match none
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3873 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3874 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
3875 if reusing && line("$") > 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3876 call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3877 " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3878 setl noma nomod nowrap
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3879 " call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3880 " call Dret("s:NetrwBrowse : re-using not-cleared buffer")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3881 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3882 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3883
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3884 " set b:netrw_curdir to the new directory name {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3885 " call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")",'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
3886 let b:netrw_curdir= dirname
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3887 if b:netrw_curdir =~ '[/\\]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3888 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3889 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
3890 if b:netrw_curdir =~ '\a:$' && (has("win32") || has("win95") || has("win64") || has("win16"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
3891 let b:netrw_curdir= b:netrw_curdir."/"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
3892 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3893 if b:netrw_curdir == ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3894 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3895 " On the Amiga, the empty string connotes the current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3896 let b:netrw_curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3897 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3898 " under unix, when the root directory is encountered, the result
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3899 " from the preceding substitute is an empty string.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3900 let b:netrw_curdir= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3901 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3902 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3903 if !a:islocal && b:netrw_curdir !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3904 let b:netrw_curdir= b:netrw_curdir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3905 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3906 " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3907
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3908 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3909 " (local only) {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3910 " ------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3911 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3912 " call Decho("local only:",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3913
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3914 " Set up ShellCmdPost handling. Append current buffer to browselist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3915 call s:LocalFastBrowser()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3916
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3917 " 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
3918 if !g:netrw_keepdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3919 " call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3920 " call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3921 if !exists("&l:acd") || !&l:acd
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3922 if s:NetrwLcd(b:netrw_curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3923 " call Dret("s:NetrwBrowse : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3924 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3925 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3926 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3927 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3928
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3929 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3930 " remote handling: {{{3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3931 " --------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3932 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3933 " call Decho("remote only:",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3934
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
3935 " analyze dirname and g:netrw_list_cmd {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3936 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
3937 if dirname =~# "^NetrwTreeListing\>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3938 let dirname= b:netrw_curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3939 " call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3940 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
3941 let dirname= substitute(b:netrw_curdir,'\\','/','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3942 if dirname !~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3943 let dirname= dirname.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3944 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3945 let b:netrw_curdir = dirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3946 " call Decho("(liststyle is TREELIST) dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3947 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
3948 let dirname = substitute(dirname,'\\','/','g')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3949 " call Decho("(normal) dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3950 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3951
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3952 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3953 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3954 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3955 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3956 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3957 NetrwKeepj call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3958 " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
3959 setl noma nomod nowrap
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3960 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3961 " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3962 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3963 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3964 let b:netrw_curdir= dirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3965 " call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3966 endif " (additional remote handling)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
3967
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3968 " -------------------------------
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3969 " Perform Directory Listing: {{{3
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3970 " -------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3971 NetrwKeepj call s:NetrwMaps(a:islocal)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3972 NetrwKeepj call s:NetrwCommands(a:islocal)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
3973 NetrwKeepj call s:PerformListing(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3974
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3975 " restore option(s)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3976 call s:NetrwOptionsRestore("w:")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3977 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3978
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3979 " If there is a rexposn: restore position with rexposn
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3980 " Otherwise : set rexposn
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3981 if exists("s:rexposn_".bufnr("%"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3982 " call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3983 NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3984 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3985 NetrwKeepj exe w:netrw_bannercnt
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
3986 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3987 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3988 NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3989 endif
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
3990 if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3991 let &l:bexpr= "netrw#BalloonHelp()"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3992 " call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
3993 setl beval
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
3994 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
3995
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3996 " repoint t:netrw_lexbufnr if appropriate
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3997 if exists("repointlexbufnr")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3998 let t:netrw_lexbufnr= bufnr("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
3999 " call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4000 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4001
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4002 " restore position
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4003 if reusing
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4004 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4005 call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4006 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4007
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4008 " The s:LocalBrowseRefresh() function is called by an autocmd
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4009 " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow or medium speed).
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4010 " However, s:NetrwBrowse() causes the FocusGained event to fire the first time.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4011 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4012 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4013 " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4014 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4015 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4016
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4017 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4018 " s:NetrwFile: because of g:netrw_keepdir, isdirectory(), type(), etc may or {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4019 " may not apply correctly; ie. netrw's idea of the current directory may
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4020 " differ from vim's. This function insures that netrw's idea of the current
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4021 " directory is used.
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4022 " Returns a path to the file specified by a:fname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4023 fun! s:NetrwFile(fname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4024 " "" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr())
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4025 " "" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4026 " "" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4027 " "" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4028 " "" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4029
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4030 " clean up any leading treedepthstring
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4031 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4032 let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','')
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4033 " "" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4034 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4035 let fname= a:fname
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4036 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4037
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4038 if g:netrw_keepdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4039 " vim's idea of the current directory possibly may differ from netrw's
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4040 if !exists("b:netrw_curdir")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4041 let b:netrw_curdir= getcwd()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4042 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4043
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4044 if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4045 if fname =~ '^\' || fname =~ '^\a:\'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4046 " windows, but full path given
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4047 let ret= fname
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4048 " "" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4049 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4050 " windows, relative path given
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4051 let ret= s:ComposePath(b:netrw_curdir,fname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4052 " "" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4053 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4054
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4055 elseif fname =~ '^/'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4056 " not windows, full path given
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4057 let ret= fname
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4058 " "" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4059 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4060 " not windows, relative path given
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4061 let ret= s:ComposePath(b:netrw_curdir,fname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4062 " "" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4063 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4064 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4065 " vim and netrw agree on the current directory
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4066 let ret= fname
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4067 " "" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4068 " "" call Decho("vim directory: ".getcwd(),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4069 " "" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4070 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4071
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4072 " "" call Dret("s:NetrwFile ".ret)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4073 return ret
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4074 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4075
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4076 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4077 " s:NetrwFileInfo: supports qf (query for file information) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4078 fun! s:NetrwFileInfo(islocal,fname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4079 " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4080 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4081 if a:islocal
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4082 let lsopt= "-lsad"
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4083 if g:netrw_sizestyle =~# 'H'
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4084 let lsopt= "-lsadh"
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4085 elseif g:netrw_sizestyle =~# 'h'
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4086 let lsopt= "-lsadh --si"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4087 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4088 if (has("unix") || has("macunix")) && executable("/bin/ls")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4089
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4090 if getline(".") == "../"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4091 echo system("/bin/ls ".lsopt." ".s:ShellEscape(".."))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4092 " call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4093
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4094 elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4095 echo system("/bin/ls ".lsopt." ".s:ShellEscape(b:netrw_curdir))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4096 " call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4097
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4098 elseif exists("b:netrw_curdir")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4099 echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname)))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4100 " call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4101
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4102 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4103 " call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4104 echo system("/bin/ls ".lsopt." ".s:ShellEscape(s:NetrwFile(a:fname)))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4105 " call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4106 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4107 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4108 " use vim functions to return information about file below cursor
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4109 " call Decho("using vim functions to query for file info",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4110 if !isdirectory(s:NetrwFile(a:fname)) && !filereadable(s:NetrwFile(a:fname)) && a:fname =~ '[*@/]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4111 let fname= substitute(a:fname,".$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4112 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4113 let fname= a:fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4114 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4115 let t = getftime(s:NetrwFile(fname))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4116 let sz = getfsize(s:NetrwFile(fname))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4117 if g:netrw_sizestyle =~# "[hH]"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4118 let sz= s:NetrwHumanReadable(sz)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4119 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4120 echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname)))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4121 " call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("<slnum>"))
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 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4124 echo "sorry, \"qf\" not supported yet for remote files"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4125 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4126 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4127 " call Dret("s:NetrwFileInfo")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4128 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4129
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4130 " ---------------------------------------------------------------------
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4131 " s:NetrwFullPath: returns the full path to a directory and/or file {{{2
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4132 fun! s:NetrwFullPath(filename)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4133 " " call Dfunc("s:NetrwFullPath(filename<".a:filename.">)")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4134 let filename= a:filename
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4135 if filename !~ '^/'
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4136 let filename= resolve(getcwd().'/'.filename)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4137 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4138 if filename != "/" && filename =~ '/$'
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4139 let filename= substitute(filename,'/$','','')
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4140 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4141 " " call Dret("s:NetrwFullPath <".filename.">")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4142 return filename
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4143 endfun
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4144
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4145 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4146 " s:NetrwGetBuffer: [get a new|find an old netrw] buffer for a netrw listing {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4147 " returns 0=cleared buffer
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4148 " 1=re-used buffer (buffer not cleared)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4149 fun! s:NetrwGetBuffer(islocal,dirname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4150 " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4151 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4152 " call Decho("netrwbuf dictionary=".(exists("s:netrwbuf")? string(s:netrwbuf) : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4153 " call Dredir("ls!","s:NetrwGetBuffer")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4154 let dirname= a:dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4155
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4156 " re-use buffer if possible {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4157 " call Decho("--re-use a buffer if possible--",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4158 if !exists("s:netrwbuf")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4159 " call Decho(" s:netrwbuf initialized to {}",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4160 let s:netrwbuf= {}
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4161 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4162 " call Decho(" s:netrwbuf =".string(s:netrwbuf),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4163 " call Decho(" w:netrw_liststyle =".(exists("w:netrw_liststyle")? w:netrw_liststyle : "n/a"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4164
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4165 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4166 let bufnum = -1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4167
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4168 if !empty(s:netrwbuf) && has_key(s:netrwbuf,s:NetrwFullPath(dirname))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4169 if has_key(s:netrwbuf,"NetrwTreeListing")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4170 let bufnum= s:netrwbuf["NetrwTreeListing"]
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4171 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4172 let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)]
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4173 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4174 " call Decho(" NetrwTreeListing: bufnum#".bufnum,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4175 if !bufexists(bufnum)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4176 call remove(s:netrwbuf,"NetrwTreeListing"])
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4177 let bufnum= -1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4178 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4179 elseif bufnr("NetrwTreeListing") != -1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4180 let bufnum= bufnr("NetrwTreeListing")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4181 " call Decho(" NetrwTreeListing".": bufnum#".bufnum,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4182 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4183 " call Decho(" did not find a NetrwTreeListing buffer",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4184 let bufnum= -1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4185 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4186
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4187 elseif has_key(s:netrwbuf,s:NetrwFullPath(dirname))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4188 let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)]
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4189 " call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum,'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4190 if !bufexists(bufnum)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4191 call remove(s:netrwbuf,s:NetrwFullPath(dirname))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4192 let bufnum= -1
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4193 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4194
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4195 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4196 " call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4197 let bufnum= -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4198 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4199 " call Decho(" bufnum#".bufnum,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4200
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4201 " highjack the current buffer if
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4202 " it has the desired name
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4203 " it is empty
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4204 " call Decho("deciding if I can highjack the current buffer#".bufnr("%"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4205 " call Decho("..dirname<".dirname.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4206 " call Decho("..bufname<".bufname("%").">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4207 " call Decho("..getline($)<".getline("$").">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4208 if dirname == bufname("%") && line("$") == 1 && getline("%") == ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4209 " call Dret("s:NetrwGetBuffer 0<cleared buffer> : highjacking buffer#".bufnr("%"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4210 return 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4211 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4212
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4213 " get enew buffer and name it -or- re-use buffer {{{3
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4214 if bufnum < 0 " get enew buffer and name it
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4215 " call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4216 call s:NetrwEnew(dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4217 " call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4218 " name the buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4219 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4220 " Got enew buffer; transform into a NetrwTreeListing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4221 " call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4222 let w:netrw_treebufnr = bufnr("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4223 call s:NetrwBufRename("NetrwTreeListing")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4224 if g:netrw_use_noswf
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4225 setl nobl bt=nofile noswf
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4226 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4227 setl nobl bt=nofile
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4228 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4229 nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[[')<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4230 nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']]')<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4231 nnoremap <silent> <buffer> [] :sil call <SID>TreeListMove('[]')<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4232 nnoremap <silent> <buffer> ][ :sil call <SID>TreeListMove('][')<cr>
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4233 " call Decho(" tree listing bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4234 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4235 call s:NetrwBufRename(dirname)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4236 " enter the new buffer into the s:netrwbuf dictionary
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4237 let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4238 " call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("<slnum>"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4239 " call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4240 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4241 " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4242
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4243 else " Re-use the buffer
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4244 " call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4245 let eikeep= &ei
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4246 setl ei=all
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4247 if getline(2) =~# '^" Netrw Directory Listing'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4248 " call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4249 exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4250 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4251 " call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4252 exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4253 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4254 " call Decho(" line($)=".line("$"),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4255 if bufname("%") == '.'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4256 call s:NetrwBufRename(getcwd())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4257 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4258 let &ei= eikeep
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4259
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4260 if line("$") <= 1 && getline(1) == ""
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4261 " empty buffer
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4262 NetrwKeepj call s:NetrwListSettings(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4263 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4264 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4265 " call Dret("s:NetrwGetBuffer 0<buffer empty> : re-using buffer#".bufnr("%").", but its empty, so refresh it")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4266 return 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4267
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4268 elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4269 " call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4270 NetrwKeepj call s:NetrwListSettings(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4271 sil NetrwKeepj %d _
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4272 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4273 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4274 " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4275 return 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4276
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4277 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4278 " call Decho("--re-use tree listing--",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4279 " call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4280 setl ma
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4281 sil NetrwKeepj %d _
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4282 NetrwKeepj call s:NetrwListSettings(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4283 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4284 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4285 " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4286 return 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4287
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4288 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4289 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4290 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4291 " call Dret("s:NetrwGetBuffer 1<buffer not cleared>")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4292 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4293 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4294 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4295
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4296 " 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
4297 " fastbrowse Local Remote Hiding a buffer implies it may be re-used (fast)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4298 " 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
4299 " med 1 D H
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4300 " fast 2 H H
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4301 " call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4302 let fname= expand("%")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4303 NetrwKeepj call s:NetrwListSettings(a:islocal)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4304 call s:NetrwBufRename(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4305
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4306 " delete all lines from buffer {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4307 " call Decho("--delete all lines from buffer--",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4308 " call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4309 sil! keepalt NetrwKeepj %d _
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4310
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4311 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4312 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4313 " call Dret("s:NetrwGetBuffer 0<cleared buffer>")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4314 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4315 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4316
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4317 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4318 " s:NetrwGetcwd: get the current directory. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4319 " Change backslashes to forward slashes, if any.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4320 " If doesc is true, escape certain troublesome characters
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4321 fun! s:NetrwGetcwd(doesc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4322 " call Dfunc("NetrwGetcwd(doesc=".a:doesc.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4323 let curdir= substitute(getcwd(),'\\','/','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4324 if curdir !~ '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4325 let curdir= curdir.'/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4326 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4327 if a:doesc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4328 let curdir= fnameescape(curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4329 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4330 " call Dret("NetrwGetcwd <".curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4331 return curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4332 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4333
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4334 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4335 " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4336 fun! s:NetrwGetWord()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4337 " call Dfunc("s:NetrwGetWord() liststyle=".s:ShowStyle()." virtcol=".virtcol("."))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4338 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4339 let keepsol= &l:sol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4340 setl nosol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4341
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4342 call s:UseBufWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4343
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4344 " insure that w:netrw_liststyle is set up
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4345 if !exists("w:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4346 if exists("g:netrw_liststyle")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4347 let w:netrw_liststyle= g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4348 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4349 let w:netrw_liststyle= s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4350 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4351 " call Decho("w:netrw_liststyle=".w:netrw_liststyle,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4352 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4353
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4354 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4355 " Active Banner support
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4356 " call Decho("active banner handling",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4357 NetrwKeepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4358 let dirname= "./"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4359 let curline= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4360
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4361 if curline =~# '"\s*Sorted by\s'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4362 NetrwKeepj norm! s
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4363 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4364 echo 'Pressing "s" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4365
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4366 elseif curline =~# '"\s*Sort sequence:'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4367 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4368 echo 'Press "S" to edit sorting sequence'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4369
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4370 elseif curline =~# '"\s*Quick Help:'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4371 NetrwKeepj norm! ?
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4372 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4373
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4374 elseif curline =~# '"\s*\%(Hiding\|Showing\):'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4375 NetrwKeepj norm! a
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4376 let s:netrw_skipbrowse= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4377 echo 'Pressing "a" also works'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4378
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4379 elseif line("$") > w:netrw_bannercnt
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4380 exe 'sil NetrwKeepj '.w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4381 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4382
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4383 elseif w:netrw_liststyle == s:THINLIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4384 " call Decho("thin column handling",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4385 NetrwKeepj norm! 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4386 let dirname= substitute(getline('.'),'\t -->.*$','','')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4387
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4388 elseif w:netrw_liststyle == s:LONGLIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4389 " call Decho("long column handling",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4390 NetrwKeepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4391 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4392
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4393 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4394 " call Decho("treelist handling",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4395 let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4396 let dirname= substitute(dirname,'\t -->.*$','','')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4397
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4398 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4399 " call Decho("obtain word from wide listing",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4400 let dirname= getline('.')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4401
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4402 if !exists("b:netrw_cpf")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4403 let b:netrw_cpf= 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4404 exe 'sil NetrwKeepj '.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
4405 call histdel("/",-1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4406 " "call Decho("computed cpf=".b:netrw_cpf,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4407 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4408
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4409 " call Decho("buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4410 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4411 " call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4412 " call Decho("1: dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4413 if filestart == 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4414 NetrwKeepj norm! 0ma
1621
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 cursor(line("."),filestart+1)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4417 NetrwKeepj norm! ma
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4418 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4419 let rega= @a
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4420 let eofname= filestart + b:netrw_cpf + 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4421 if eofname <= col("$")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4422 call cursor(line("."),filestart+b:netrw_cpf+1)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4423 NetrwKeepj norm! "ay`a
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4424 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4425 NetrwKeepj norm! "ay$
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
4426 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4427 let dirname = @a
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4428 let @a = rega
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4429 " call Decho("2: dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4430 let dirname= substitute(dirname,'\s\+$','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4431 " call Decho("3: dirname<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4432 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4433
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4434 " symlinks are indicated by a trailing "@". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4435 let dirname= substitute(dirname,"@$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4436
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4437 " executables are indicated by a trailing "*". Remove it before further processing.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4438 let dirname= substitute(dirname,"\*$","","")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4439
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4440 let &l:sol= keepsol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4441
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4442 " call Dret("s:NetrwGetWord <".dirname.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4443 return dirname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4444 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4445
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4446 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4447 " s:NetrwListSettings: make standard settings for making a netrw listing {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4448 " g:netrw_bufsettings will be used after the listing is produced.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4449 " Called by s:NetrwGetBuffer()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4450 fun! s:NetrwListSettings(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4451 " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4452 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4453 let fname= bufname("%")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4454 " " call Decho("setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4455 " nobl noma nomod nonu noma nowrap ro nornu (std g:netrw_bufsettings)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4456 setl bt=nofile nobl ma nonu nowrap noro nornu
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4457 call s:NetrwBufRename(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4458 if g:netrw_use_noswf
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4459 setl noswf
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4460 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4461 " call Dredir("ls!","s:NetrwListSettings")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4462 " call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4463 exe "setl ts=".(g:netrw_maxfilenamelen+1)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4464 setl isk+=.,~,-
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4465 if g:netrw_fastbrowse > a:islocal
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4466 setl bh=hide
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4467 else
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4468 setl bh=delete
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4469 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4470 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4471 " call Dret("s:NetrwListSettings")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4472 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4473
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4474 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4475 " s:NetrwListStyle: change list style (thin - long - wide - tree) {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4476 " islocal=0: remote browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4477 " =1: local browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4478 fun! s:NetrwListStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4479 " call Dfunc("NetrwListStyle(islocal=".a:islocal.") w:netrw_liststyle=".w:netrw_liststyle)
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4480
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4481 let ykeep = @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4482 let fname = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4483 if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4484 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4485 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4486 let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4487 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4488 " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4489 " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4490
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4491 " repoint t:netrw_lexbufnr if appropriate
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4492 if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4493 " call Decho("set repointlexbufnr to true!")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4494 let repointlexbufnr= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4495 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4496
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4497 if w:netrw_liststyle == s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4498 " use one column listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4499 " call Decho("use one column list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4500 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4501
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4502 elseif w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4503 " use long list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4504 " call Decho("use long list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4505 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4506
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4507 elseif w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4508 " give wide list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4509 " call Decho("use wide list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4510 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4511
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4512 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4513 " call Decho("use tree list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4514 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4515
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4516 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4517 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4518 let g:netrw_liststyle = s:THINLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4519 let w:netrw_liststyle = g:netrw_liststyle
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4520 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4521 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4522 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4523 " call Decho("setl ma noro",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4524
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4525 " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4526 " call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4527 sil! NetrwKeepj %d _
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4528 " following prevents tree listing buffer from being marked "modified"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4529 " call Decho("setl nomod",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
4530 setl nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4531 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4532
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4533 " refresh the listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4534 " call Decho("refresh the listing",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4535 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4536 NetrwKeepj call s:NetrwCursor()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4537
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4538 " repoint t:netrw_lexbufnr if appropriate
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4539 if exists("repointlexbufnr")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4540 let t:netrw_lexbufnr= bufnr("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4541 " call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4542 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4543
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4544 " restore position; keep cursor on the filename
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4545 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4546 NetrwKeepj call winrestview(svpos)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4547 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4548
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4549 " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : ""))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4550 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4551
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4552 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4553 " s:NetrwBannerCtrl: toggles the display of the banner {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4554 fun! s:NetrwBannerCtrl(islocal)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4555 " 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
4556
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4557 let ykeep= @@
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4558 " toggle the banner (enable/suppress)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4559 let g:netrw_banner= !g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4560
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4561 " refresh the listing
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4562 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4563 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4564 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4565
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4566 " keep cursor on the filename
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4567 if g:netrw_banner && exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4568 let fname= s:NetrwGetWord()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4569 sil NetrwKeepj $
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4570 let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4571 " " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4572 if result <= 0 && exists("w:netrw_bannercnt")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4573 exe "NetrwKeepj ".w:netrw_bannercnt
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4574 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4575 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4576 let @@= ykeep
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4577 " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4578 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4579
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4580 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4581 " s:NetrwBookmark: supports :NetrwMB[!] [file]s {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4582 "
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4583 " No bang: enters files/directories into Netrw's bookmark system
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4584 " No argument and in netrw buffer:
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4585 " if there are marked files: bookmark marked files
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4586 " otherwise : bookmark file/directory under cursor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4587 " No argument and not in netrw buffer: bookmarks current open file
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4588 " Has arguments: globs them individually and bookmarks them
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4589 "
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4590 " With bang: deletes files/directories from Netrw's bookmark system
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4591 fun! s:NetrwBookmark(del,...)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4592 " call Dfunc("s:NetrwBookmark(del=".a:del.",...) a:0=".a:0)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4593 if a:0 == 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4594 if &ft == "netrw"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4595 let curbufnr = bufnr("%")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4596
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4597 if exists("s:netrwmarkfilelist_{curbufnr}")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4598 " for every filename in the marked list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4599 " call Decho("bookmark every filename in marked list",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4600 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4601 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4602 let islocal= expand("%") !~ '^\a\{3,}://'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4603 for fname in s:netrwmarkfilelist_{curbufnr}
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4604 if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4605 endfor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4606 let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4607 call s:NetrwUnmarkList(curbufnr,curdir)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4608 NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4609 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4610 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4611 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4612 let fname= s:NetrwGetWord()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4613 if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4614 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4615
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4616 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4617 " bookmark currently open file
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4618 " call Decho("bookmark currently open file",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4619 let fname= expand("%")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4620 if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4621 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4622
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4623 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4624 " bookmark specified files
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4625 " attempts to infer if working remote or local
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4626 " by deciding if the current file begins with an url
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4627 " Globbing cannot be done remotely.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4628 let islocal= expand("%") !~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4629 " call Decho("bookmark specified file".((a:0>1)? "s" : ""),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4630 let i = 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4631 while i <= a:0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4632 if islocal
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4633 if v:version > 704 || (v:version == 704 && has("patch656"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4634 let mbfiles= glob(fnameescape(a:{i}),0,1,1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4635 else
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4636 let mbfiles= glob(fnameescape(a:{i}),0,1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4637 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4638 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4639 let mbfiles= [a:{i}]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4640 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4641 " call Decho("mbfiles".string(mbfiles),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4642 for mbfile in mbfiles
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4643 " call Decho("mbfile<".mbfile.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4644 if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4645 endfor
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4646 let i= i + 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4647 endwhile
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4648 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4649
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4650 " update the menu
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4651 call s:NetrwBookmarkMenu()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4652
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4653 " call Dret("s:NetrwBookmark")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4654 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4655
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4656 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4657 " s:NetrwBookmarkMenu: Uses menu priorities {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4658 " .2.[cnt] for bookmarks, and
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4659 " .3.[cnt] for history
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4660 " (see s:NetrwMenu())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4661 fun! s:NetrwBookmarkMenu()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4662 if !exists("s:netrw_menucnt")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4663 return
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4664 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4665 " call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhistcnt." menucnt=".s:netrw_menucnt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4666
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4667 " the following test assures that gvim is running, has menus available, and has menus enabled.
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4668 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
4669 if exists("g:NetrwTopLvlMenu")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4670 " call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4671 exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks'
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4672 exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4673 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4674 if !exists("s:netrw_initbookhist")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4675 call s:NetrwBookHistRead()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4676 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4677
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4678 " show bookmarked places
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4679 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4680 let cnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4681 for bmd in g:netrw_bookmarklist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4682 " call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd,'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4683 let bmd= escape(bmd,g:netrw_menu_escape)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4684
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4685 " show bookmarks for goto menu
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4686 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
4687
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4688 " show bookmarks for deletion menu
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4689 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
4690 let cnt= cnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4691 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4692
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4693 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4694
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4695 " show directory browsing history
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4696 if g:netrw_dirhistmax > 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4697 let cnt = g:netrw_dirhistcnt
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4698 let first = 1
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4699 let histcnt = 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4700 while ( first || cnt != g:netrw_dirhistcnt )
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4701 let histcnt = histcnt + 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4702 let priority = g:netrw_dirhistcnt + histcnt
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4703 if exists("g:netrw_dirhist_{cnt}")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4704 let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4705 " call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4706 exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\<cr>"
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4707 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4708 let first = 0
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4709 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4710 if cnt < 0
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4711 let cnt= cnt + g:netrw_dirhistmax
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4712 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4713 endwhile
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4714 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4715
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4716 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4717 " call Dret("NetrwBookmarkMenu")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4718 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4719
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4720 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4721 " s:NetrwBrowseChgDir: constructs a new directory based on the current {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4722 " directory and a new directory name. Also, if the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4723 " "new directory name" is actually a file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4724 " NetrwBrowseChgDir() edits the file.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4725 fun! s:NetrwBrowseChgDir(islocal,newdir,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4726 " 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 : "").">")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4727 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4728
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4729 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4730 if !exists("b:netrw_curdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4731 " 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
4732 " and the current window is the NetrwMessage window.
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4733 let @@= ykeep
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4734 " call Decho("b:netrw_curdir doesn't exist!",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4735 " call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4736 " call Dredir("ls!","s:NetrwBrowseChgDir")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4737 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4738 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4739 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4740 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4741
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4742 " NetrwBrowseChgDir: save options and initialize {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4743 " call Decho("saving options",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4744 call s:SavePosn(s:netrw_posn)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4745 NetrwKeepj call s:NetrwOptionsSave("s:")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4746 NetrwKeepj call s:NetrwOptionsSafe(a:islocal)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4747 if (has("win32") || has("win95") || has("win64") || has("win16"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4748 let dirname = substitute(b:netrw_curdir,'\\','/','ge')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4749 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4750 let dirname = b:netrw_curdir
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4751 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4752 let newdir = a:newdir
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
4753 let dolockout = 0
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4754 let dorestore = 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4755 " call Decho("dirname<".dirname.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4756 " call Decho("newdir<".newdir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4757
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4758 " ignore <cr>s when done in the banner
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4759 " call Decho('(s:NetrwBrowseChgDir) ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4760 if g:netrw_banner
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4761 " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4762 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4763 if getline(".") =~# 'Quick Help'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4764 " call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4765 let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4766 " call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4767 setl ma noro nowrap
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4768 NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp])
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4769 setl noma nomod nowrap
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4770 NetrwKeepj call s:NetrwOptionsRestore("s:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4771 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4772 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4773 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4774 " else " Decho
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4775 " call Decho("g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4776 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4777
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4778 " set up o/s-dependent directory recognition pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4779 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4780 let dirpat= '[\/:]$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4781 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4782 let dirpat= '[\/]$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4783 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4784 " call Decho("set up o/s-dependent directory recognition pattern: dirname<".dirname."> dirpat<".dirpat.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4785
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4786 if dirname !~ dirpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4787 " apparently vim is "recognizing" that it is in a directory and
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
4788 " is removing the trailing "/". Bad idea, so let's put it back.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4789 let dirname= dirname.'/'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4790 " call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4791 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4792
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4793 " call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4794 if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir))))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4795 " ------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4796 " NetrwBrowseChgDir: edit a file {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4797 " ------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4798 " call Decho('(s:NetrwBrowseChgDir) edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
4799
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4800 " save position for benefit of Rexplore
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4801 let s:rexposn_{bufnr("%")}= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4802 " call Decho("edit-a-file: saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4803 " call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4804 " call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
4805
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4806 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4807 " call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4808 " call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4809 let dirname= s:NetrwTreeDir(a:islocal)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4810 "COMBAK : not working for a symlink -- but what about a regular file? a directory?
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4811 " call Decho("COMBAK : not working for a symlink -- but what about a regular file? a directory?")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4812 " Feb 17, 2019: following if-else-endif restored -- wasn't editing a file in tree mode
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4813 if dirname =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4814 let dirname= dirname.newdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4815 else
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4816 let dirname= dirname."/".newdir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4817 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4818 " call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4819 " call Decho("edit-a-file: tree listing",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4820 elseif newdir =~ '^\(/\|\a:\)'
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4821 " call Decho("edit-a-file: handle an url or path starting with /: <".newdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4822 let dirname= newdir
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
4823 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4824 let dirname= s:ComposePath(dirname,newdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4825 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4826 " call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4827 " this lets netrw#BrowseX avoid the edit
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4828 if a:0 < 1
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4829 " call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4830 NetrwKeepj call s:NetrwOptionsRestore("s:")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4831 let curdir= b:netrw_curdir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4832 if !exists("s:didsplit")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4833 " call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4834 if type(g:netrw_browse_split) == 3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4835 " open file in server
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4836 " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4837 " call Decho("edit-a-file: open file in server",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4838 call s:NetrwServerEdit(a:islocal,dirname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4839 " call Dret("s:NetrwBrowseChgDir")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4840 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4841 elseif g:netrw_browse_split == 1
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4842 " horizontally splitting the window first
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4843 " call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4844 keepalt new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4845 if !&ea
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4846 keepalt wincmd _
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4847 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4848 call s:SetRexDir(a:islocal,curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4849 elseif g:netrw_browse_split == 2
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4850 " vertically splitting the window first
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4851 " call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4852 keepalt rightb vert new
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4853 if !&ea
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4854 keepalt wincmd |
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4855 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4856 call s:SetRexDir(a:islocal,curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4857 elseif g:netrw_browse_split == 3
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4858 " open file in new tab
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4859 " call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
4860 keepalt tabnew
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4861 if !exists("b:netrw_curdir")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4862 let b:netrw_curdir= getcwd()
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4863 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4864 call s:SetRexDir(a:islocal,curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4865 elseif g:netrw_browse_split == 4
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4866 " act like "P" (ie. open previous window)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4867 " call Decho("edit-a-file: use previous window for edit",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4868 if s:NetrwPrevWinOpen(2) == 3
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4869 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4870 " call Dret("s:NetrwBrowseChgDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4871 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4872 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
4873 call s:SetRexDir(a:islocal,curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4874 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4875 " handling a file, didn't split, so remove menu
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4876 " call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4877 call s:NetrwMenu(0)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4878 " optional change to window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4879 if g:netrw_chgwin >= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4880 " call Decho("edit-a-file: changing window to #".g:netrw_chgwin,'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4881 if winnr("$")+1 == g:netrw_chgwin
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4882 " if g:netrw_chgwin is set to one more than the last window, then
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4883 " vertically split the last window to make that window available.
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4884 let curwin= winnr()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4885 exe "NetrwKeepj keepalt ".winnr("$")."wincmd w"
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4886 vs
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4887 exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4888 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4889 exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4890 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
4891 call s:SetRexDir(a:islocal,curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4892 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4893 endif
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
4894
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4895 " the point where netrw actually edits the (local) file
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4896 " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4897 " no keepalt to support :e # to return to a directory listing
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4898 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4899 " call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4900 " some like c-^ to return to the last edited file
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4901 " others like c-^ to return to the netrw buffer
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4902 if exists("g:netrw_altfile") && g:netrw_altfile
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4903 exe "NetrwKeepj keepalt e! ".fnameescape(dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4904 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4905 exe "NetrwKeepj e! ".fnameescape(dirname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4906 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4907 " call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4908 call s:NetrwCursor()
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4909 if &hidden || &bufhidden == "hide"
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4910 " file came from vim's hidden storage. Don't "restore" options with it.
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4911 let dorestore= 0
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
4912 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4913 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4914 " call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4915 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4916 let dolockout= 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4917
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4918 " handle g:Netrw_funcref -- call external-to-netrw functions
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4919 " 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
4920 " 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
4921 " a function reference. See :help Funcref for information about function references.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4922 if exists("g:Netrw_funcref")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4923 " call Decho("edit-a-file: handle optional Funcrefs",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4924 if type(g:Netrw_funcref) == 2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4925 " call Decho("edit-a-file: handling a g:Netrw_funcref",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4926 NetrwKeepj call g:Netrw_funcref()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4927 elseif type(g:Netrw_funcref) == 3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4928 " call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4929 for Fncref in g:Netrw_funcref
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4930 if type(FncRef) == 2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4931 NetrwKeepj call FncRef()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4932 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4933 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4934 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
4935 endif
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4938 elseif newdir =~ '^/'
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4939 " ----------------------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4940 " NetrwBrowseChgDir: just go to the new directory spec {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4941 " ----------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4942 " call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4943 let dirname = newdir
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4944 NetrwKeepj call s:SetRexDir(a:islocal,dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4945 NetrwKeepj call s:NetrwOptionsRestore("s:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4946 norm! m`
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4947
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4948 elseif newdir == './'
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4949 " ---------------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4950 " NetrwBrowseChgDir: refresh the directory list {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4951 " ---------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4952 " call Decho('(s:NetrwBrowseChgDir)refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
4953 NetrwKeepj call s:SetRexDir(a:islocal,dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4954 norm! m`
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4955
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4956 elseif newdir == '../'
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4957 " --------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4958 " NetrwBrowseChgDir: go up one directory {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
4959 " --------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4960 " call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../"','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4961
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4962 if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4963 " force a refresh
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4964 " call Decho("go-up: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4965 " call Decho("go-up: setl noro ma",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
4966 setl noro ma
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4967 NetrwKeepj %d _
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4968 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4969
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4970 if has("amiga")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4971 " amiga
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4972 " call Decho('go-up: case "go up one directory": newdir == "../" and amiga','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4973 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4974 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4975 let dirname= substitute(dirname,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4976 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4977 let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4978 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4979 " call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4980
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4981 elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4982 " windows
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4983 if a:islocal
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4984 let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','')
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4985 if dirname == ""
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4986 let dirname= '/'
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4987 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4988 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4989 let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','')
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4990 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4991 if dirname =~ '^\a:$'
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4992 let dirname= dirname.'/'
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4993 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
4994 " call Decho("go-up: windows: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
4995
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4996 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4997 " unix or cygwin
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
4998 " call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
4999 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5000 let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5001 if dirname == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5002 let dirname= '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5003 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5004 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5005 let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5006 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5007 " call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5008 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5009 NetrwKeepj call s:SetRexDir(a:islocal,dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5010 norm! m`
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5011
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5012 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5013 " --------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5014 " NetrwBrowseChgDir: Handle Tree Listing {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5015 " --------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5016 " call Decho('(s:NetrwBrowseChgDir)tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5017 " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5018 " call Decho("tree-list: setl noro ma",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
5019 setl noro ma
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5020 if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5021 " call Decho("tree-list: clear buffer<".expand("%")."> with :%d (force refresh)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5022 NetrwKeepj %d _
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5023 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5024 let treedir = s:NetrwTreeDir(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5025 " call Decho("tree-list: treedir<".treedir.">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5026 let s:treecurpos = winsaveview()
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5027 let haskey = 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5028 " call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5029
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5030 " search treedict for tree dir as-is
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5031 " call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5032 if has_key(w:netrw_treedict,treedir)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5033 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5034 let haskey= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5035 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5036 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5037 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5038
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5039 " search treedict for treedir with a [/@] appended
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5040 " call Decho("tree-list: search treedict for treedir with a [/@] appended",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5041 if !haskey && treedir !~ '[/@]$'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5042 if has_key(w:netrw_treedict,treedir."/")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5043 let treedir= treedir."/"
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5044 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5045 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5046 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5047 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5048 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5049 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5050
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5051 " search treedict for treedir with any trailing / elided
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5052 " call Decho("tree-list: search treedict for treedir with any trailing / elided",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5053 if !haskey && treedir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5054 let treedir= substitute(treedir,'/$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5055 if has_key(w:netrw_treedict,treedir)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5056 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5057 let haskey = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5058 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5059 " call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5060 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5061 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5062
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5063 " call Decho("haskey=".haskey,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5064 if haskey
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5065 " close tree listing for selected subdirectory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5066 " call Decho("tree-list: closing selected subdirectory<".dirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5067 call remove(w:netrw_treedict,treedir)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5068 " call Decho("tree-list: removed entry<".treedir."> from treedict",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5069 " call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">",'~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5070 let dirname= w:netrw_treetop
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5071 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5072 " go down one directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5073 let dirname= substitute(treedir,'/*$','/','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5074 " call Decho("tree-list: go down one dir: treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5075 " call Decho("tree-list: ... : dirname<".dirname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5076 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5077 NetrwKeepj call s:SetRexDir(a:islocal,dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5078 " call Decho("setting s:treeforceredraw to true",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5079 let s:treeforceredraw = 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5080
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5081 else
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5082 " ----------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5083 " NetrwBrowseChgDir: Go down one directory {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5084 " ----------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5085 let dirname = s:ComposePath(dirname,newdir)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5086 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5087 NetrwKeepj call s:SetRexDir(a:islocal,dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5088 norm! m`
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5089 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5090
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5091 " --------------------------------------
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5092 " NetrwBrowseChgDir: Restore and Cleanup {{{3
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5093 " --------------------------------------
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5094 if dorestore
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5095 " dorestore is zero'd when a local file was hidden or bufhidden;
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5096 " in such a case, we want to keep whatever settings it may have.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5097 " call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5098 NetrwKeepj call s:NetrwOptionsRestore("s:")
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5099 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5100 " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5101 endif
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5102 if dolockout && dorestore
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5103 " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
5104 if filewritable(dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5105 " call Decho("restore: doing modification lockout settings: ma nomod noro",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5106 " call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5107 setl ma noro nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5108 " call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5109 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5110 " call Decho("restore: doing modification lockout settings: ma nomod ro",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5111 " call Decho("restore: setl ma nomod noro",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
5112 setl ma ro nomod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5113 " call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
5114 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5115 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5116 call s:RestorePosn(s:netrw_posn)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5117 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5118
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5119 " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5120 return dirname
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5121 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5122
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5123 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5124 " s:NetrwBrowseUpDir: implements the "-" mappings {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5125 " for thin, long, and wide: cursor placed just after banner
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5126 " for tree, keeps cursor on current filename
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5127 fun! s:NetrwBrowseUpDir(islocal)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5128 " call Dfunc("s:NetrwBrowseUpDir(islocal=".a:islocal.")")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5129 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5130 " this test needed because occasionally this function seems to be incorrectly called
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5131 " when multiple leftmouse clicks are taken when atop the one line help in the banner.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5132 " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5133 " directories.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5134 " call Dret("s:NetrwBrowseUpDir : cursor not in file area")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5135 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5136 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5137
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5138 norm! 0
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5139 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5140 " call Decho("case: treestyle",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5141 let curline= getline(".")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5142 let swwline= winline() - 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5143 if exists("w:netrw_treetop")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5144 let b:netrw_curdir= w:netrw_treetop
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5145 elseif exists("b:netrw_curdir")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5146 let w:netrw_treetop= b:netrw_curdir
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5147 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5148 let w:netrw_treetop= getcwd()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5149 let b:netrw_curdir = w:netrw_treetop
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5150 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5151 let curfile = getline(".")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5152 let curpath = s:NetrwTreePath(w:netrw_treetop)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5153 if a:islocal
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5154 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5155 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5156 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5157 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5158 " call Decho("looking for curfile<^".s:treedepthstring.curfile.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5159 " call Decho("having curpath<".curpath.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5160 if w:netrw_treetop == '/'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5161 keepj call search('^\M'.curfile,"w")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5162 elseif curfile == '../'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5163 keepj call search('^\M'.curfile,"wb")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5164 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5165 " call Decho("search(^\\M".s:treedepthstring.curfile.") backwards"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5166 while 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5167 keepj call search('^\M'.s:treedepthstring.curfile,"wb")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5168 let treepath= s:NetrwTreePath(w:netrw_treetop)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5169 " call Decho("..current treepath<".treepath.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5170 if treepath == curpath
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5171 break
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5172 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5173 endwhile
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5174 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5175
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5176 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5177 " call Decho("case: not treestyle",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5178 call s:SavePosn(s:netrw_posn)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5179 if exists("b:netrw_curdir")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5180 let curdir= b:netrw_curdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5181 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5182 let curdir= expand(getcwd())
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5183 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5184 if a:islocal
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5185 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5186 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5187 call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5188 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5189 call s:RestorePosn(s:netrw_posn)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5190 let curdir= substitute(curdir,'^.*[\/]','','')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5191 call search('\<'.curdir.'/','wc')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5192 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5193 " call Dret("s:NetrwBrowseUpDir")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5194 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5195
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
5196 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5197 " netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5198 " given filename; typically this means given their extension.
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5199 " 0=local, 1=remote
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5200 fun! netrw#BrowseX(fname,remote)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5201 " call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5202
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5203 " if its really just a local directory, then do a "gf" instead
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5204 if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && a:fname =~ '/$' && a:fname !~ '^https\=:')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5205 norm! gf
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5206 " call Dret("(netrw#BrowseX) did gf instead")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5207 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5208
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5209 let ykeep = @@
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5210 let screenposn = winsaveview()
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5211 " call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5212
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5213 " need to save and restore aw setting as gx can invoke this function from non-netrw buffers
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5214 let awkeep = &aw
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5215 set noaw
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5216
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5217 " special core dump handler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5218 if a:fname =~ '/core\(\.\d\+\)\=$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5219 if exists("g:Netrw_corehandler")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5220 if type(g:Netrw_corehandler) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5221 " g:Netrw_corehandler is a function reference (see :help Funcref)
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5222 " call Decho("g:Netrw_corehandler is a funcref",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5223 call g:Netrw_corehandler(s:NetrwFile(a:fname))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5224 elseif type(g:Netrw_corehandler) == 3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5225 " g:Netrw_corehandler is a List of function references (see :help Funcref)
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5226 " call Decho("g:Netrw_corehandler is a List",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5227 for Fncref in g:Netrw_corehandler
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5228 if type(FncRef) == 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5229 call FncRef(a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5230 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5231 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5232 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5233 " call Decho("restoring posn: screenposn<".string(screenposn).">,'~'.expand("<slnum>"))"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5234 call winrestview(screenposn)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5235 let @@= ykeep
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5236 let &aw= awkeep
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5237 " call Dret("netrw#BrowseX : coredump handler invoked")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5238 return
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5239 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5240 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5241
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5242 " set up the filename
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5243 " (lower case the extension, make a local copy of a remote file)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5244 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5245 if has("win32") || has("win95") || has("win64") || has("win16")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5246 let exten= substitute(exten,'^.*$','\L&\E','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5247 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5248 if exten =~ "[\\/]"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5249 let exten= ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5250 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5251 " call Decho("exten<".exten.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5252
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5253 if a:remote == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5254 " create a local copy
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5255 " call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5256 setl bh=delete
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5257 call netrw#NetRead(3,a:fname)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5258 " attempt to rename tempfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5259 let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','')
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5260 let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','')
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5261 " call Decho("basename<".basename.">",'~'.expand("<slnum>"))
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5262 " call Decho("newname <".newname.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5263 if s:netrw_tmpfile != newname && newname != ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5264 if rename(s:netrw_tmpfile,newname) == 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5265 " renaming succeeded
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5266 " call Decho("renaming succeeded (tmpfile<".s:netrw_tmpfile."> to <".newname.">)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5267 let fname= newname
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5268 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5269 " renaming failed
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5270 " call Decho("renaming failed (tmpfile<".s:netrw_tmpfile."> to <".newname.">)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5271 let fname= s:netrw_tmpfile
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5272 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5273 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5274 let fname= s:netrw_tmpfile
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5275 endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5276 else
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5277 " call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5278 let fname= a:fname
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5279 " special ~ handler for local
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5280 if fname =~ '^\~' && expand("$HOME") != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5281 " call Decho('invoking special ~ handler','~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5282 let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),''))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5283 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5284 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5285 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5286 " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5287
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5288 " set up redirection (avoids browser messages)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5289 " by default, g:netrw_suppress_gx_mesg is true
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5290 if g:netrw_suppress_gx_mesg
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5291 if &srr =~ "%s"
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5292 if (has("win32") || has("win95") || has("win64") || has("win16"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5293 let redir= substitute(&srr,"%s","nul","")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5294 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5295 let redir= substitute(&srr,"%s","/dev/null","")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5296 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5297 elseif (has("win32") || has("win95") || has("win64") || has("win16"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5298 let redir= &srr . "nul"
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5299 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5300 let redir= &srr . "/dev/null"
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5301 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5302 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5303 " call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5304
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5305 " extract any viewing options. Assumes that they're set apart by quotes.
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5306 " call Decho("extract any viewing options",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5307 if exists("g:netrw_browsex_viewer")
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5308 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5309 if g:netrw_browsex_viewer =~ '\s'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5310 let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5311 let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5312 let oviewer = ''
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5313 let cnt = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5314 while !executable(viewer) && viewer != oviewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5315 let viewer = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5316 let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5317 let cnt = cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5318 let oviewer = viewer
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5319 " call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5320 endwhile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5321 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5322 let viewer = g:netrw_browsex_viewer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5323 let viewopt = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5324 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5325 " call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5326 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5327
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5328 " execute the file handler
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5329 " call Decho("execute the file handler (if any)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5330 if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-'
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5331 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5332 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5333
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5334 elseif exists("g:netrw_browsex_viewer") && executable(viewer)
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5335 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5336 call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5337 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5338
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5339 elseif has("win32") || has("win64")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5340 " call Decho("win".(has("win32")? "32" : "64")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5341 if executable("start")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5342 call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5343 elseif executable("rundll32")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5344 call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5345 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5346 call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5347 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5348 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5349 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5350
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5351 elseif has("win32unix")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5352 let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g')
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5353 " call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5354 if executable("start")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5355 call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5356 elseif executable("rundll32")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5357 call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5358 elseif executable("cygstart")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5359 call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5360 else
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5361 call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5362 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5363 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5364 let ret= v:shell_error
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5365
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5366 elseif has("unix") && executable("kfmclient") && s:CheckIfKde()
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5367 " call Decho("unix and kfmclient",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5368 call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5369 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5370
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5371 elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid")
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5372 " call Decho("unix, exo-open, xdg-open",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5373 call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5374 let ret= v:shell_error
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5375
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5376 elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5377 " call Decho("unix and atril",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5378 call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5379 let ret= v:shell_error
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5380
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5381 elseif has("unix") && executable("xdg-open")
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5382 " call Decho("unix and xdg-open",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5383 call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5384 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5385
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5386 elseif has("macunix") && executable("open")
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5387 " call Decho("macunix and open",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5388 call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5389 let ret= v:shell_error
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5390
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5391 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5392 " netrwFileHandlers#Invoke() always returns 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5393 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5394 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5395
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5396 " if unsuccessful, attempt netrwFileHandlers#Invoke()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5397 if ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5398 let ret= netrwFileHandlers#Invoke(exten,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5399 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5400
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5401 " restoring redraw! after external file handlers
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5402 redraw!
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5403
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5404 " cleanup: remove temporary file,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5405 " delete current buffer if success with handler,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5406 " return to prior buffer (directory listing)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5407 " Feb 12, 2008: had to de-activiate removal of
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5408 " temporary file because it wasn't getting seen.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5409 " if a:remote == 1 && fname != a:fname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5410 "" call Decho("deleting temporary file<".fname.">",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
5411 " call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5412 " endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5413
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5414 if a:remote == 1
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5415 setl bh=delete bt=nofile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5416 if g:netrw_use_noswf
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5417 setl noswf
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5418 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5419 exe "sil! NetrwKeepj norm! \<c-o>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5420 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5421 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
5422 " call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5423 call winrestview(screenposn)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5424 let @@ = ykeep
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5425 let &aw= awkeep
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5426
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5427 " call Dret("netrw#BrowseX")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5428 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5429
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5430 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5431 " netrw#GX: gets word under cursor for gx support {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5432 " See also: netrw#BrowseXVis
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5433 " netrw#BrowseX
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5434 fun! netrw#GX()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5435 " call Dfunc("netrw#GX()")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5436 if &ft == "netrw"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5437 let fname= s:NetrwGetWord()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5438 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5439 let fname= expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>'))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5440 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5441 " call Dret("netrw#GX <".fname.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5442 return fname
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5443 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5444
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5445 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5446 " netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5447 fun! netrw#BrowseXVis()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5448 " call Dfunc("netrw#BrowseXVis()")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5449 let atkeep = @@
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5450 norm! gvy
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5451 " call Decho("@@<".@@.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5452 call netrw#BrowseX(@@,netrw#CheckIfRemote(@@))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5453 let @@ = atkeep
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5454 " call Dret("netrw#BrowseXVis")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5455 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5456
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5457 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5458 " s:NetrwBufRename: renames a buffer without the side effect of retaining an unlisted buffer having the old name {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5459 " Using the file command on a "[No Name]" buffer does not seem to cause the old "[No Name]" buffer
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5460 " to become an unlisted buffer, so in that case don't bwipe it.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5461 fun! s:NetrwBufRename(newname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5462 " call Dfunc("s:NetrwBufRename(newname<".a:newname.">) buf(%)#".bufnr("%")."<".bufname(bufnr("%")).">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5463 " call Dredir("ls!","s:NetrwBufRename (before rename)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5464 let oldbufname= bufname(bufnr("%"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5465 " call Decho("buf#".bufnr("%").": oldbufname<".oldbufname.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5466
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5467 if oldbufname != a:newname
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5468 " call Decho("do buffer rename: oldbufname<".oldbufname."> ≠ a:newname<".a:newname.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5469 let b:junk= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5470 " call Decho("rename buffer: sil! keepj keepalt file ".fnameescape(a:newname),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5471 exe 'sil! keepj keepalt file '.fnameescape(a:newname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5472 " call Dredir("ls!","s:NetrwBufRename (before bwipe)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5473 let oldbufnr= bufnr(oldbufname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5474 " call Decho("oldbufname<".oldbufname."> oldbufnr#".oldbufnr,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5475 " call Decho("bufnr(%)=".bufnr("%"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5476 if oldbufname != "" && oldbufnr != -1 && oldbufnr != bufnr("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5477 " call Decho("bwipe ".oldbufnr,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5478 exe "bwipe! ".oldbufnr
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5479 " else " Decho
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5480 " call Decho("did *not* bwipe buf#".oldbufnr,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5481 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5482 " call Dredir("ls!","s:NetrwBufRename (after rename)")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5483 " else " Decho
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5484 " call Decho("oldbufname<".oldbufname."> == a:newname: did *not* rename",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5485 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5486
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5487 " call Dret("s:NetrwBufRename : buf#".bufnr("%").": oldname<".oldbufname."> newname<".a:newname."> expand(%)<".expand("%").">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5488 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5489
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5490 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5491 " netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5492 fun! netrw#CheckIfRemote(...)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5493 " call Dfunc("netrw#CheckIfRemote() a:0=".a:0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5494 if a:0 > 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5495 let curfile= a:1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5496 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5497 let curfile= expand("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5498 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5499 " call Decho("curfile<".curfile.">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5500 if curfile =~ '^\a\{3,}://'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5501 " call Dret("netrw#CheckIfRemote 1")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5502 return 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5503 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5504 " call Dret("netrw#CheckIfRemote 0")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5505 return 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5506 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5507 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5508
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
5509 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5510 " s:NetrwChgPerm: (implements "gp") change file permission {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5511 fun! s:NetrwChgPerm(islocal,curdir)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5512 " call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5513 let ykeep = @@
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5514 call inputsave()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5515 let newperm= input("Enter new permission: ")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5516 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5517 let chgperm= substitute(g:netrw_chgperm,'\<FILENAME\>',s:ShellEscape(expand("<cfile>")),'')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5518 let chgperm= substitute(chgperm,'\<PERM\>',s:ShellEscape(newperm),'')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5519 " call Decho("chgperm<".chgperm.">",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5520 call system(chgperm)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5521 if v:shell_error != 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5522 NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("<cfile>")."> seems to have failed",75)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5523 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5524 if a:islocal
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5525 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5526 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5527 let @@= ykeep
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5528 " call Dret("s:NetrwChgPerm")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5529 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5530
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5531 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5532 " s:CheckIfKde: checks if kdeinit is running {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5533 " Returns 0: kdeinit not running
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5534 " 1: kdeinit is running
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5535 fun! s:CheckIfKde()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5536 " call Dfunc("s:CheckIfKde()")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5537 " seems kde systems often have gnome-open due to dependencies, even though
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5538 " gnome-open's subsidiary display tools are largely absent. Kde systems
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5539 " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5540 if !exists("s:haskdeinit")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5541 if has("unix") && executable("ps") && !has("win32unix")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5542 let s:haskdeinit= system("ps -e") =~ '\<kdeinit'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5543 if v:shell_error
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5544 let s:haskdeinit = 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5545 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5546 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5547 let s:haskdeinit= 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5548 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5549 " call Decho("setting s:haskdeinit=".s:haskdeinit,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5550 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5551
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5552 " call Dret("s:CheckIfKde ".s:haskdeinit)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5553 return s:haskdeinit
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5554 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5555
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5556 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5557 " s:NetrwClearExplore: clear explore variables (if any) {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5558 fun! s:NetrwClearExplore()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5559 " call Dfunc("s:NetrwClearExplore()")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5560 2match none
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5561 if exists("s:explore_match") |unlet s:explore_match |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5562 if exists("s:explore_indx") |unlet s:explore_indx |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5563 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
5564 if exists("s:dirstarstar") |unlet s:dirstarstar |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5565 if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5566 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
5567 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
5568 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
5569 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
5570 " redraw!
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5571 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5572 echo " "
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5573 " call Dret("s:NetrwClearExplore")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5574 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5575
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5576 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5577 " s:NetrwExploreListUniq: {{{2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5578 fun! s:NetrwExploreListUniq(explist)
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
5579 " call Dfunc("s:NetrwExploreListUniq(explist<".string(a:explist).">)")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5580
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5581 " this assumes that the list is already sorted
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5582 let newexplist= []
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5583 for member in a:explist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5584 if !exists("uniqmember") || member != uniqmember
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5585 let uniqmember = member
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5586 let newexplist = newexplist + [ member ]
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5587 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5588 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5589
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
5590 " call Dret("s:NetrwExploreListUniq newexplist<".string(newexplist).">")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5591 return newexplist
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5592 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5593
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5594 " ---------------------------------------------------------------------
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5595 " s:NetrwForceChgDir: (gd support) Force treatment as a directory {{{2
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5596 fun! s:NetrwForceChgDir(islocal,newdir)
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5597 " call Dfunc("s:NetrwForceChgDir(islocal=".a:islocal." newdir<".a:newdir.">)")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5598 let ykeep= @@
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5599 if a:newdir !~ '/$'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5600 " ok, looks like force is needed to get directory-style treatment
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5601 if a:newdir =~ '@$'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5602 let newdir= substitute(a:newdir,'@$','/','')
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5603 elseif a:newdir =~ '[*=|\\]$'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5604 let newdir= substitute(a:newdir,'.$','/','')
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5605 else
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5606 let newdir= a:newdir.'/'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5607 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5608 " call Decho("adjusting newdir<".newdir."> due to gd",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5609 else
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5610 " should already be getting treatment as a directory
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5611 let newdir= a:newdir
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5612 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5613 let newdir= s:NetrwBrowseChgDir(a:islocal,newdir)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5614 call s:NetrwBrowse(a:islocal,newdir)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5615 let @@= ykeep
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5616 " call Dret("s:NetrwForceChgDir")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5617 endfun
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5618
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5619 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5620 " s:NetrwGlob: does glob() if local, remote listing otherwise {{{2
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5621 " direntry: this is the name of the directory. Will be fnameescape'd to prevent wildcard handling by glob()
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5622 " expr : this is the expression to follow the directory. Will use s:ComposePath()
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5623 " pare =1: remove the current directory from the resulting glob() filelist
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5624 " =0: leave the current directory in the resulting glob() filelist
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5625 fun! s:NetrwGlob(direntry,expr,pare)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5626 " call Dfunc("s:NetrwGlob(direntry<".a:direntry."> expr<".a:expr."> pare=".a:pare.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5627 if netrw#CheckIfRemote()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5628 keepalt 1sp
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5629 keepalt enew
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5630 let keep_liststyle = w:netrw_liststyle
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5631 let w:netrw_liststyle = s:THINLIST
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5632 if s:NetrwRemoteListing() == 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5633 keepj keepalt %s@/@@
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5634 let filelist= getline(1,$)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5635 q!
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5636 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5637 " remote listing error -- leave treedict unchanged
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5638 let filelist= w:netrw_treedict[a:direntry]
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5639 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5640 let w:netrw_liststyle= keep_liststyle
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5641 elseif v:version > 704 || (v:version == 704 && has("patch656"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5642 let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1,1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5643 if a:pare
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5644 let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5645 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5646 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5647 let filelist= glob(s:ComposePath(fnameescape(a:direntry),a:expr),0,1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5648 if a:pare
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5649 let filelist= map(filelist,'substitute(v:val, "^.*/", "", "")')
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
5650 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5651 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5652 " call Dret("s:NetrwGlob ".string(filelist))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5653 return filelist
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5654 endfun
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5655
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5656 " ---------------------------------------------------------------------
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5657 " s:NetrwForceFile: (gf support) Force treatment as a file {{{2
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5658 fun! s:NetrwForceFile(islocal,newfile)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5659 " call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newfile.">)")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5660 if a:newfile =~ '[/@*=|\\]$'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5661 let newfile= substitute(a:newfile,'.$','','')
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5662 else
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5663 let newfile= a:newfile
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5664 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5665 if a:islocal
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5666 call s:NetrwBrowseChgDir(a:islocal,newfile)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5667 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5668 call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,newfile))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5669 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5670 " call Dret("s:NetrwForceFile")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5671 endfun
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5672
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5673 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5674 " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5675 " and switches the hiding mode. The actual hiding is done by
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5676 " s:NetrwListHide().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5677 " g:netrw_hide= 0: show all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5678 " 1: show not-hidden files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5679 " 2: show hidden files only
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5680 fun! s:NetrwHide(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5681 " call Dfunc("NetrwHide(islocal=".a:islocal.") g:netrw_hide=".g:netrw_hide)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5682 let ykeep= @@
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5683 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5684 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5685
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5686 if exists("s:netrwmarkfilelist_{bufnr('%')}")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5687 " call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5688 " call Decho("g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5689
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5690 " hide the files in the markfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5691 for fname in s:netrwmarkfilelist_{bufnr("%")}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5692 " call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5693 if match(g:netrw_list_hide,'\<'.fname.'\>') != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5694 " remove fname from hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5695 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
5696 let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5697 let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5698 " call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5699 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5700 " append fname to hiding list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5701 if exists("g:netrw_list_hide") && g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5702 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
5703 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5704 let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5705 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5706 " call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5707 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5708 endfor
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5709 NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5710 let g:netrw_hide= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5711
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5712 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5713
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5714 " switch between show-all/show-not-hidden/show-hidden
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5715 let g:netrw_hide=(g:netrw_hide+1)%3
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5716 exe "NetrwKeepj norm! 0"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5717 if g:netrw_hide && g:netrw_list_hide == ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5718 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5719 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5720 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5721 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5722 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5723 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5724
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5725 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5726 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5727 NetrwKeepj call winrestview(svpos)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5728 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5729 " call Dret("NetrwHide")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5730 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5731
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5732 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5733 " s:NetrwHideEdit: allows user to edit the file/directory hiding list {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5734 fun! s:NetrwHideEdit(islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5735 " call Dfunc("NetrwHideEdit(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5736
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5737 let ykeep= @@
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5738 " save current cursor position
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5739 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5740 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5741
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5742 " get new hiding list from user
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5743 call inputsave()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5744 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5745 call inputrestore()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5746 let g:netrw_list_hide= newhide
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5747 " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5748
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5749 " refresh the listing
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5750 sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5751
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5752 " restore cursor position
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5753 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5754 call winrestview(svpos)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5755 let @@= ykeep
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5756
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5757 " call Dret("NetrwHideEdit")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5758 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5759
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5760 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5761 " s:NetrwHidden: invoked by "gh" {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5762 fun! s:NetrwHidden(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5763 " call Dfunc("s:NetrwHidden()")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5764 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5765 " save current position
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5766 let svpos = winsaveview()
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5767 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5768
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5769 if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5770 " remove .file pattern from hiding list
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5771 " call Decho("remove .file pattern from hiding list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5772 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
5773 elseif s:Strlen(g:netrw_list_hide) >= 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5774 " call Decho("add .file pattern from hiding list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5775 let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5776 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5777 " call Decho("set .file pattern as hiding list",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5778 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5779 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5780 if g:netrw_list_hide =~ '^,'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5781 let g:netrw_list_hide= strpart(g:netrw_list_hide,1)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5782 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5783
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5784 " refresh screen and return to saved position
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5785 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5786 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5787 NetrwKeepj call winrestview(svpos)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5788 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5789 " call Dret("s:NetrwHidden")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5790 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5791
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5792 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5793 " 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
5794 fun! s:NetrwHome()
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5795 if exists("g:netrw_home")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5796 let home= expand(g:netrw_home)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5797 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5798 " go to vim plugin home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5799 for home in split(&rtp,',') + ['']
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5800 if isdirectory(s:NetrwFile(home)) && filewritable(s:NetrwFile(home)) | break | endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5801 let basehome= substitute(home,'[/\\]\.vim$','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5802 if isdirectory(s:NetrwFile(basehome)) && filewritable(s:NetrwFile(basehome))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5803 let home= basehome."/.vim"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5804 break
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5805 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5806 endfor
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5807 if home == ""
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5808 " just pick the first directory
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5809 let home= substitute(&rtp,',.*$','','')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5810 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5811 if (has("win32") || has("win95") || has("win64") || has("win16"))
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5812 let home= substitute(home,'/','\\','g')
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5813 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5814 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5815 " insure that the home directory exists
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5816 if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5817 " call Decho("insure that the home<".home."> directory exists")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5818 if exists("g:netrw_mkdir")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5819 " call Decho("call system(".g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)).")")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5820 call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5821 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5822 " call Decho("mkdir(".home.")")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5823 call mkdir(home)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5824 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5825 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5826 let g:netrw_home= home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5827 return home
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5828 endfun
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5829
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
5830 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5831 " s:NetrwLeftmouse: handles the <leftmouse> when in a netrw browsing window {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5832 fun! s:NetrwLeftmouse(islocal)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5833 if exists("s:netrwdrag")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5834 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
5835 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5836 if &ft != "netrw"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5837 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5838 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5839 " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5840
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5841 let ykeep= @@
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5842 " check if the status bar was clicked on instead of a file/directory name
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5843 while getchar(0) != 0
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5844 "clear the input stream
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5845 endwhile
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5846 call feedkeys("\<LeftMouse>")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
5847 let c = getchar()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5848 let mouse_lnum = v:mouse_lnum
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5849 let wlastline = line('w$')
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5850 let lastline = line('$')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5851 " call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5852 " call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0),'~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5853 if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr()
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5854 " appears to be a status bar leftmouse click
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5855 let @@= ykeep
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5856 " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5857 return
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5858 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5859 " Dec 04, 2013: following test prevents leftmouse selection/deselection of directories and files in treelist mode
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
5860 " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5861 " without this test when its disabled.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5862 " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5863 " call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$"),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5864 if v:mouse_col > virtcol('.')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5865 let @@= ykeep
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5866 " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5867 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5868 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
5869
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5870 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5871 if exists("b:netrw_curdir")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5872 NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5873 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5874 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5875 if exists("b:netrw_curdir")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5876 NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5877 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5878 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
5879 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5880 " call Dret("s:NetrwLeftmouse")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5881 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5882
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
5883 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5884 " s:NetrwCLeftmouse: used to select a file/directory for a target {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5885 fun! s:NetrwCLeftmouse(islocal)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5886 if &ft != "netrw"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5887 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5888 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5889 " call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5890 call s:NetrwMarkFileTgt(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5891 " call Dret("s:NetrwCLeftmouse")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5892 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5893
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5894 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5895 " s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements <c-r>){{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5896 " a:islocal=0 : <c-r> not used, remote
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
5897 " a:islocal=1 : <c-r> not used, local
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5898 " a:islocal=2 : <c-r> used, remote
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5899 " a:islocal=3 : <c-r> used, local
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5900 fun! s:NetrwServerEdit(islocal,fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5901 " call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5902 let islocal = a:islocal%2 " =0: remote =1: local
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5903 let ctrlr = a:islocal >= 2 " =0: <c-r> not used =1: <c-r> used
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5904 " call Decho("islocal=".islocal." ctrlr=".ctrlr,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5905
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5906 if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5907 " handle directories in the local window -- not in the remote vim server
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5908 " user must have closed the NETRWSERVER window. Treat as normal editing from netrw.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5909 " call Decho("handling directory in client window",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5910 let g:netrw_browse_split= 0
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
5911 if exists("s:netrw_browse_split") && exists("s:netrw_browse_split_".winnr())
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5912 let g:netrw_browse_split= s:netrw_browse_split_{winnr()}
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5913 unlet s:netrw_browse_split_{winnr()}
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5914 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5915 call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5916 " call Dret("s:NetrwServerEdit")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5917 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5918 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5919
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5920 " call Decho("handling file in server window",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5921 if has("clientserver") && executable("gvim")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5922 " call Decho("has clientserver and gvim",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5923
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5924 if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5925 " call Decho("g:netrw_browse_split=".string(g:netrw_browse_split),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5926 let srvrname = g:netrw_browse_split[0]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5927 let tabnum = g:netrw_browse_split[1]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5928 let winnum = g:netrw_browse_split[2]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5929
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5930 if serverlist() !~ '\<'.srvrname.'\>'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5931 " call Decho("server not available; ctrlr=".ctrlr,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5932
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5933 if !ctrlr
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5934 " user must have closed the server window and the user did not use <c-r>, but
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5935 " used something like <cr>.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5936 " call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5937 if exists("g:netrw_browse_split")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5938 unlet g:netrw_browse_split
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5939 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5940 let g:netrw_browse_split= 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5941 if exists("s:netrw_browse_split_".winnr())
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5942 let g:netrw_browse_split= s:netrw_browse_split_{winnr()}
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5943 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5944 call s:NetrwBrowseChgDir(islocal,a:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5945 " call Dret("s:NetrwServerEdit")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5946 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5947
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5948 elseif has("win32") && executable("start")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5949 " start up remote netrw server under windows
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5950 " call Decho("starting up gvim server<".srvrname."> for windows",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5951 call system("start gvim --servername ".srvrname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5952
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5953 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5954 " start up remote netrw server under linux
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5955 " call Decho("starting up gvim server<".srvrname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5956 call system("gvim --servername ".srvrname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5957 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5958 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5959
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5960 " call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5961 call remote_send(srvrname,":tabn ".tabnum."\<cr>")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5962 call remote_send(srvrname,":".winnum."wincmd w\<cr>")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5963 call remote_send(srvrname,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5964
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5965 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5966
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5967 if serverlist() !~ '\<'.g:netrw_servername.'\>'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5968
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5969 if !ctrlr
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5970 " call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5971 if exists("g:netrw_browse_split")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5972 unlet g:netrw_browse_split
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5973 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5974 let g:netrw_browse_split= 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5975 call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5976 " call Dret("s:NetrwServerEdit")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5977 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5978
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5979 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5980 " call Decho("server<".g:netrw_servername."> not available but ctrl-r used",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5981 if has("win32") && executable("start")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5982 " start up remote netrw server under windows
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5983 " call Decho("starting up gvim server<".g:netrw_servername."> for windows",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5984 call system("start gvim --servername ".g:netrw_servername)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5985 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5986 " start up remote netrw server under linux
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5987 " call Decho("starting up gvim server<".g:netrw_servername.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5988 call system("gvim --servername ".g:netrw_servername)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5989 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5990 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5991 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5992
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5993 while 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5994 try
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5995 " call Decho("remote-send: e ".a:fname,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
5996 call remote_send(g:netrw_servername,":e ".fnameescape(s:NetrwFile(a:fname))."\<cr>")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5997 break
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5998 catch /^Vim\%((\a\+)\)\=:E241/
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
5999 sleep 200m
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6000 endtry
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6001 endwhile
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6002
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6003 if exists("g:netrw_browse_split")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6004 if type(g:netrw_browse_split) != 3
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6005 let s:netrw_browse_split_{winnr()}= g:netrw_browse_split
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6006 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6007 unlet g:netrw_browse_split
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6008 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6009 let g:netrw_browse_split= [g:netrw_servername,1,1]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6010 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6011
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6012 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6013 call netrw#ErrorMsg(s:ERROR,"you need a gui-capable vim and client-server to use <ctrl-r>",98)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6014 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6015
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6016 " call Dret("s:NetrwServerEdit")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6017 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6018
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6019 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6020 " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6021 fun! s:NetrwSLeftmouse(islocal)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6022 if &ft != "netrw"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6023 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6024 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6025 " call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6026
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6027 let s:ngw= s:NetrwGetWord()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6028 call s:NetrwMarkFile(a:islocal,s:ngw)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6029
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6030 " call Dret("s:NetrwSLeftmouse")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6031 endfun
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6032
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6033 " ---------------------------------------------------------------------
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6034 " s:NetrwSLeftdrag: invoked via a shift-leftmouse and dragging {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6035 " Used to mark multiple files.
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6036 fun! s:NetrwSLeftdrag(islocal)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6037 " call Dfunc("s:NetrwSLeftdrag(islocal=".a:islocal.")")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6038 if !exists("s:netrwdrag")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6039 let s:netrwdrag = winnr()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6040 if a:islocal
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6041 nno <silent> <s-leftrelease> <leftmouse>:<c-u>call <SID>NetrwSLeftrelease(1)<cr>
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6042 else
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6043 nno <silent> <s-leftrelease> <leftmouse>:<c-u>call <SID>NetrwSLeftrelease(0)<cr>
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6044 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6045 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6046 let ngw = s:NetrwGetWord()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6047 if !exists("s:ngw") || s:ngw != ngw
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6048 call s:NetrwMarkFile(a:islocal,ngw)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6049 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6050 let s:ngw= ngw
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6051 " call Dret("s:NetrwSLeftdrag : s:netrwdrag=".s:netrwdrag." buf#".bufnr("%"))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6052 endfun
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6053
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6054 " ---------------------------------------------------------------------
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6055 " s:NetrwSLeftrelease: terminates shift-leftmouse dragging {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6056 fun! s:NetrwSLeftrelease(islocal)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6057 " call Dfunc("s:NetrwSLeftrelease(islocal=".a:islocal.") s:netrwdrag=".s:netrwdrag." buf#".bufnr("%"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6058 if exists("s:netrwdrag")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6059 nunmap <s-leftrelease>
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6060 let ngw = s:NetrwGetWord()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6061 if !exists("s:ngw") || s:ngw != ngw
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6062 call s:NetrwMarkFile(a:islocal,ngw)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6063 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6064 if exists("s:ngw")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6065 unlet s:ngw
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6066 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6067 unlet s:netrwdrag
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6068 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6069 " call Dret("s:NetrwSLeftrelease")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6070 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6071
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6072 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6073 " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6074 " separated patterns given in g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6075 fun! s:NetrwListHide()
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6076 " call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6077 " call Decho("initial: ".string(getline(w:netrw_bannercnt,'$')))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6078 let ykeep= @@
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6079 " call DechoBuf(bufnr("%"),"COMBAK#3")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6080
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6081 " find a character not in the "hide" string to use as a separator for :g and :v commands
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6082 " How-it-works: take the hiding command, convert it into a range.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6083 " Duplicate characters don't matter.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6084 " Remove all such characters from the '/~@#...890' string.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6085 " Use the first character left as a separator character.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6086 " call Decho("find a character not in the hide string to use as a separator")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6087 let listhide= g:netrw_list_hide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6088 let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6089 " call Decho("sep=".sep,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6090
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6091 while listhide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6092 if listhide =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6093 let hide = substitute(listhide,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6094 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6095 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6096 let hide = listhide
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6097 let listhide = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6098 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6099 " call Decho("hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6100
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6101 " Prune the list by hiding any files which match
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6102 " call Decho("prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6103 if g:netrw_hide == 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6104 " call Decho("..hiding<".hide.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6105 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6106 elseif g:netrw_hide == 2
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6107 " call Decho("..showing<".hide.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6108 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6109 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6110 " call Decho("..result: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6111 endwhile
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6112
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6113 if g:netrw_hide == 2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6114 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6115 " call Decho("..v KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6116 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6117 " call Decho("..g KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6118 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6119
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6120 " remove any blank lines that have somehow remained.
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6121 " This seems to happen under Windows.
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6122 exe 'sil! NetrwKeepj 1,$g@^\s*$@d'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6123 " call DechoBuf(bufnr("%"),"COMBAK#4")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6124
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6125 let @@= ykeep
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6126 " call Dret("s:NetrwListHide")
1621
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:NetrwMakeDir: this function makes a directory (both local and remote) {{{2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6131 " implements the "d" mapping.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6132 fun! s:NetrwMakeDir(usrhost)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6133 " call Dfunc("s:NetrwMakeDir(usrhost<".a:usrhost.">)")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6134
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6135 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6136 " get name of new directory from user. A bare <CR> will skip.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6137 " if its currently a directory, also request will be skipped, but with
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6138 " a message.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6139 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6140 let newdirname= input("Please give directory name: ")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6141 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6142 " call Decho("newdirname<".newdirname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6143
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6144 if newdirname == ""
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6145 let @@= ykeep
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6146 " call Dret("s:NetrwMakeDir : user aborted with bare <cr>")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6147 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6148 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6149
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6150 if a:usrhost == ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6151 " call Decho("local mkdir",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6152
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6153 " Local mkdir:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6154 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6155 let fullnewdir= b:netrw_curdir.'/'.newdirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6156 " call Decho("fullnewdir<".fullnewdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6157 if isdirectory(s:NetrwFile(fullnewdir))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6158 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6159 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6160 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6161 let @@= ykeep
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6162 " call Dret("s:NetrwMakeDir : directory<".newdirname."> exists previously")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6163 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6164 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6165 if s:FileReadable(fullnewdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6166 if !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6167 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6168 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6169 let @@= ykeep
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6170 " call Dret("s:NetrwMakeDir : file<".newdirname."> exists previously")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6171 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6172 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6173
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6174 " requested new local directory is neither a pre-existing file or
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6175 " directory, so make it!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6176 if exists("*mkdir")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6177 if has("unix")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6178 call mkdir(fullnewdir,"p",xor(0777, system("umask")))
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6179 else
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6180 call mkdir(fullnewdir,"p")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
6181 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6182 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6183 let netrw_origdir= s:NetrwGetcwd(1)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6184 if s:NetrwLcd(b:netrw_curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6185 " call Dret("s:NetrwMakeDir : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6186 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6187 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6188 " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6189 call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(newdirname,1))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6190 if v:shell_error != 0
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6191 let @@= ykeep
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6192 call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6193 " call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6194 return
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6195 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6196 if !g:netrw_keepdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6197 " call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6198 if s:NetrwLcd(netrw_origdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6199 " call Dret("s:NetrwBrowse : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6200 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6201 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6202 endif
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 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6206 " refresh listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6207 " call Decho("refresh listing",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6208 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6209 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6210 call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6211 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6212 call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6213 elseif !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6214 call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",26)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6215 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6216 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6217
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6218 elseif !exists("b:netrw_method") || b:netrw_method == 4
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6219 " Remote mkdir: using ssh
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6220 " call Decho("remote mkdir",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6221 let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6222 let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6223 call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6224 if v:shell_error == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6225 " refresh listing
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6226 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6227 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6228 NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6229 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6230 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6231 elseif !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6232 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6233 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6234 " redraw!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6235
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6236 elseif b:netrw_method == 2
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6237 " Remote mkdir: using ftp+.netrc
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6238 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6239 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6240 " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6241 if exists("b:netrw_fname")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6242 " call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6243 let remotepath= b:netrw_fname
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6244 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6245 let remotepath= ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6246 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6247 call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6248 NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6249 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6250 NetrwKeepj call winrestview(svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6251
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6252 elseif b:netrw_method == 3
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6253 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6254 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6255 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6256 " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6257 if exists("b:netrw_fname")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6258 " call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6259 let remotepath= b:netrw_fname
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6260 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6261 let remotepath= ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6262 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6263 call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6264 NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6265 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6266 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6267 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6268
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6269 let @@= ykeep
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6270 " call Dret("s:NetrwMakeDir")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6271 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6272
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6273 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6274 " s:TreeSqueezeDir: allows a shift-cr (gvim only) to squeeze the current tree-listing directory {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6275 fun! s:TreeSqueezeDir(islocal)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6276 " call Dfunc("s:TreeSqueezeDir(islocal=".a:islocal.")")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6277 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6278 " its a tree-listing style
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6279 let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6280 let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6281 let depth = strchars(substitute(curdepth,' ','','g'))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6282 let srch = -1
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6283 " call Decho("curdepth<".curdepth.'>','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6284 " call Decho("depth =".depth,'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6285 " call Decho("stopline#".stopline,'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6286 " call Decho("curline#".line(".")."<".getline('.').'>','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6287 if depth >= 2
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6288 NetrwKeepj norm! 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6289 let curdepthm1= substitute(curdepth,'^'.s:treedepthstring,'','')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6290 let srch = search('^'.curdepthm1.'\%('.s:treedepthstring.'\)\@!','bW',stopline)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6291 " call Decho("curdepthm1<".curdepthm1.'>','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6292 " call Decho("case depth>=2: srch<".srch.'>','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6293 elseif depth == 1
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6294 NetrwKeepj norm! 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6295 let treedepthchr= substitute(s:treedepthstring,' ','','')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6296 let srch = search('^[^'.treedepthchr.']','bW',stopline)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6297 " call Decho("case depth==1: srch<".srch.'>','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6298 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6299 if srch > 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6300 " call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6301 call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord()))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6302 exe srch
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6303 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6304 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6305 " call Dret("s:TreeSqueezeDir")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6306 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6307
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6308 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6309 " s:NetrwMaps: {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6310 fun! s:NetrwMaps(islocal)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6311 " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6312
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6313 " mouse <Plug> maps: {{{3
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6314 if g:netrw_mousemaps && g:netrw_retmap
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6315 " call Decho("set up Rexplore 2-leftmouse",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6316 if !hasmapto("<Plug>NetrwReturn")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6317 if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6318 " call Decho("making map for 2-leftmouse",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6319 nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6320 elseif maparg("<c-leftmouse>","n") == ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6321 " call Decho("making map for c-leftmouse",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6322 nmap <unique> <silent> <c-leftmouse> <Plug>NetrwReturn
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6323 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6324 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6325 nno <silent> <Plug>NetrwReturn :Rexplore<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6326 " call Decho("made <Plug>NetrwReturn map",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6327 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6328
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6329 " generate default <Plug> maps {{{3
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6330 if !hasmapto('<Plug>NetrwHide') |nmap <buffer> <silent> <nowait> a <Plug>NetrwHide_a|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6331 if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir |endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6332 if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6333 if !hasmapto('<Plug>NetrwBadd_cb') |nmap <buffer> <silent> <nowait> cb <Plug>NetrwBadd_cb|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6334 if !hasmapto('<Plug>NetrwBadd_cB') |nmap <buffer> <silent> <nowait> cB <Plug>NetrwBadd_cB|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6335 if !hasmapto('<Plug>NetrwLcd') |nmap <buffer> <silent> <nowait> cd <Plug>NetrwLcd|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6336 if !hasmapto('<Plug>NetrwSetChgwin') |nmap <buffer> <silent> <nowait> C <Plug>NetrwSetChgwin|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6337 if !hasmapto('<Plug>NetrwRefresh') |nmap <buffer> <silent> <nowait> <c-l> <Plug>NetrwRefresh|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6338 if !hasmapto('<Plug>NetrwLocalBrowseCheck') |nmap <buffer> <silent> <nowait> <cr> <Plug>NetrwLocalBrowseCheck|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6339 if !hasmapto('<Plug>NetrwServerEdit') |nmap <buffer> <silent> <nowait> <c-r> <Plug>NetrwServerEdit|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6340 if !hasmapto('<Plug>NetrwMakeDir') |nmap <buffer> <silent> <nowait> d <Plug>NetrwMakeDir|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6341 if !hasmapto('<Plug>NetrwBookHistHandler_gb')|nmap <buffer> <silent> <nowait> gb <Plug>NetrwBookHistHandler_gb|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6342 " ---------------------------------------------------------------------
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6343 " if !hasmapto('<Plug>NetrwForceChgDir') |nmap <buffer> <silent> <nowait> gd <Plug>NetrwForceChgDir|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6344 " if !hasmapto('<Plug>NetrwForceFile') |nmap <buffer> <silent> <nowait> gf <Plug>NetrwForceFile|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6345 " if !hasmapto('<Plug>NetrwHidden') |nmap <buffer> <silent> <nowait> gh <Plug>NetrwHidden|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6346 " if !hasmapto('<Plug>NetrwSetTreetop') |nmap <buffer> <silent> <nowait> gn <Plug>NetrwSetTreetop|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6347 " if !hasmapto('<Plug>NetrwChgPerm') |nmap <buffer> <silent> <nowait> gp <Plug>NetrwChgPerm|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6348 " if !hasmapto('<Plug>NetrwBannerCtrl') |nmap <buffer> <silent> <nowait> I <Plug>NetrwBannerCtrl|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6349 " if !hasmapto('<Plug>NetrwListStyle') |nmap <buffer> <silent> <nowait> i <Plug>NetrwListStyle|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6350 " if !hasmapto('<Plug>NetrwMarkMoveMF2Arglist')|nmap <buffer> <silent> <nowait> ma <Plug>NetrwMarkMoveMF2Arglist|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6351 " if !hasmapto('<Plug>NetrwMarkMoveArglist2MF')|nmap <buffer> <silent> <nowait> mA <Plug>NetrwMarkMoveArglist2MF|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6352 " if !hasmapto('<Plug>NetrwBookHistHandler_mA')|nmap <buffer> <silent> <nowait> mb <Plug>NetrwBookHistHandler_mA|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6353 " if !hasmapto('<Plug>NetrwBookHistHandler_mB')|nmap <buffer> <silent> <nowait> mB <Plug>NetrwBookHistHandler_mB|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6354 " if !hasmapto('<Plug>NetrwMarkFileCopy') |nmap <buffer> <silent> <nowait> mc <Plug>NetrwMarkFileCopy|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6355 " if !hasmapto('<Plug>NetrwMarkFileDiff') |nmap <buffer> <silent> <nowait> md <Plug>NetrwMarkFileDiff|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6356 " if !hasmapto('<Plug>NetrwMarkFileEdit') |nmap <buffer> <silent> <nowait> me <Plug>NetrwMarkFileEdit|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6357 " if !hasmapto('<Plug>NetrwMarkFile') |nmap <buffer> <silent> <nowait> mf <Plug>NetrwMarkFile|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6358 " if !hasmapto('<Plug>NetrwUnmarkList') |nmap <buffer> <silent> <nowait> mF <Plug>NetrwUnmarkList|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6359 " if !hasmapto('<Plug>NetrwMarkFileGrep') |nmap <buffer> <silent> <nowait> mg <Plug>NetrwMarkFileGrep|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6360 " if !hasmapto('<Plug>NetrwMarkHideSfx') |nmap <buffer> <silent> <nowait> mh <Plug>NetrwMarkHideSfx|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6361 " if !hasmapto('<Plug>NetrwMarkFileMove') |nmap <buffer> <silent> <nowait> mm <Plug>NetrwMarkFileMove|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6362 " if !hasmapto('<Plug>NetrwMarkFilePrint') |nmap <buffer> <silent> <nowait> mp <Plug>NetrwMarkFilePrint|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6363 " if !hasmapto('<Plug>NetrwMarkFileRegexp') |nmap <buffer> <silent> <nowait> mr <Plug>NetrwMarkFileRegexp|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6364 " if !hasmapto('<Plug>NetrwMarkFileSource') |nmap <buffer> <silent> <nowait> ms <Plug>NetrwMarkFileSource|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6365 " if !hasmapto('<Plug>NetrwMarkFileTag') |nmap <buffer> <silent> <nowait> mT <Plug>NetrwMarkFileTag|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6366 " if !hasmapto('<Plug>NetrwMarkFileTgt') |nmap <buffer> <silent> <nowait> mt <Plug>NetrwMarkFileTgt|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6367 " if !hasmapto('<Plug>NetrwUnMarkFile') |nmap <buffer> <silent> <nowait> mu <Plug>NetrwUnMarkFile|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6368 " if !hasmapto('<Plug>NetrwMarkFileVimCmd') |nmap <buffer> <silent> <nowait> mv <Plug>NetrwMarkFileVimCmd|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6369 " if !hasmapto('<Plug>NetrwMarkFileExe_mx') |nmap <buffer> <silent> <nowait> mx <Plug>NetrwMarkFileExe_mx|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6370 " if !hasmapto('<Plug>NetrwMarkFileExe_mX') |nmap <buffer> <silent> <nowait> mX <Plug>NetrwMarkFileExe_mX|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6371 " if !hasmapto('<Plug>NetrwMarkFileCompress') |nmap <buffer> <silent> <nowait> mz <Plug>NetrwMarkFileCompress|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6372 " if !hasmapto('<Plug>NetrwObtain') |nmap <buffer> <silent> <nowait> O <Plug>NetrwObtain|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6373 " if !hasmapto('<Plug>NetrwSplit_o') |nmap <buffer> <silent> <nowait> o <Plug>NetrwSplit_o|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6374 " if !hasmapto('<Plug>NetrwPreview') |nmap <buffer> <silent> <nowait> p <Plug>NetrwPreview|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6375 " if !hasmapto('<Plug>NetrwPrevWinOpen') |nmap <buffer> <silent> <nowait> P <Plug>NetrwPrevWinOpen|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6376 " if !hasmapto('<Plug>NetrwBookHistHandler_qb')|nmap <buffer> <silent> <nowait> qb <Plug>NetrwBookHistHandler_qb|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6377 " if !hasmapto('<Plug>NetrwFileInfo') |nmap <buffer> <silent> <nowait> qf <Plug>NetrwFileInfo|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6378 " if !hasmapto('<Plug>NetrwMarkFileQFEL_qF') |nmap <buffer> <silent> <nowait> qF <Plug>NetrwMarkFileQFEL_qF|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6379 " if !hasmapto('<Plug>NetrwMarkFileQFEL_qL') |nmap <buffer> <silent> <nowait> qL <Plug>NetrwMarkFileQFEL_qL|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6380 " if !hasmapto('<Plug>NetrwSortStyle') |nmap <buffer> <silent> <nowait> s <Plug>NetrwSortStyle|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6381 " if !hasmapto('<Plug>NetSortSequence') |nmap <buffer> <silent> <nowait> S <Plug>NetSortSequence|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6382 " if !hasmapto('<Plug>NetrwSetTgt_Tb') |nmap <buffer> <silent> <nowait> Tb <Plug>NetrwSetTgt_Tb|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6383 " if !hasmapto('<Plug>NetrwSetTgt_Th') |nmap <buffer> <silent> <nowait> Th <Plug>NetrwSetTgt_Th|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6384 " if !hasmapto('<Plug>NetrwSplit_t') |nmap <buffer> <silent> <nowait> t <Plug>NetrwSplit_t|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6385 " if !hasmapto('<Plug>NetrwBookHistHandler_u') |nmap <buffer> <silent> <nowait> u <Plug>NetrwBookHistHandler_u|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6386 " if !hasmapto('<Plug>NetrwBookHistHandler_U') |nmap <buffer> <silent> <nowait> U <Plug>NetrwBookHistHandler_U|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6387 " if !hasmapto('<Plug>NetrwSplit_v') |nmap <buffer> <silent> <nowait> v <Plug>NetrwSplit_v|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6388 " if !hasmapto('<Plug>NetrwBrowseX') |nmap <buffer> <silent> <nowait> x <Plug>NetrwBrowseX|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6389 " if !hasmapto('<Plug>NetrwLocalExecute') |nmap <buffer> <silent> <nowait> X <Plug>NetrwLocalExecute|endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6390
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6391 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6392 " call Decho("make local maps",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6393 " local normal-mode maps {{{3
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6394 nnoremap <buffer> <silent> <Plug>NetrwHide_a :<c-u>call <SID>NetrwHide(1)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6395 nnoremap <buffer> <silent> <Plug>NetrwBrowseUpDir :<c-u>call <SID>NetrwBrowseUpDir(1)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6396 nnoremap <buffer> <silent> <Plug>NetrwOpenFile :<c-u>call <SID>NetrwOpenFile(1)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6397 nnoremap <buffer> <silent> <Plug>NetrwBadd_cb :<c-u>call <SID>NetrwBadd(1,0)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6398 nnoremap <buffer> <silent> <Plug>NetrwBadd_cB :<c-u>call <SID>NetrwBadd(1,1)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6399 nnoremap <buffer> <silent> <Plug>NetrwLcd :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6400 nnoremap <buffer> <silent> <Plug>NetrwSetChgwin :<c-u>call <SID>NetrwSetChgwin()<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6401 nnoremap <buffer> <silent> <Plug>NetrwLocalBrowseCheck :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6402 nnoremap <buffer> <silent> <Plug>NetrwServerEdit :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6403 nnoremap <buffer> <silent> <Plug>NetrwMakeDir :<c-u>call <SID>NetrwMakeDir("")<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6404 nnoremap <buffer> <silent> <Plug>NetrwBookHistHandler_gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6405 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6406 nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6407 nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6408 nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr>
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6409 nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(0,<SID>NetrwGetWord())<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6410 nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6411 nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6412 nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6413 nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(1,0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6414 nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(1,1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6415 nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6416 nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6417 nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6418 nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6419 nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6420 nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6421 nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6422 nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6423 nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6424 nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6425 nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6426 nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6427 nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(1)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6428 nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6429 nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6430 nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6431 nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6432 nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(1,0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6433 nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(1,1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6434 nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(1)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6435 nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6436 nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(3)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6437 nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6438 nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6439 nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6440 nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6441 nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6442 nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6443 nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6444 nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6445 nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6446 nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(4)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6447 nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6448 nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6449 nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6450 nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6451 nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6452 nnoremap <buffer> <silent> <nowait> X :<c-u>call <SID>NetrwLocalExecute(expand("<cword>"))"<cr>
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6453
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6454 nnoremap <buffer> <silent> <nowait> r :<c-u>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>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6455 if !hasmapto('<Plug>NetrwHideEdit')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6456 nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6457 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6458 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6459 if !hasmapto('<Plug>NetrwRefresh')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6460 nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6461 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6462 nnoremap <buffer> <silent> <Plug>NetrwRefresh <c-l>:call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6463 if s:didstarstar || !mapcheck("<s-down>","n")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6464 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6465 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6466 if s:didstarstar || !mapcheck("<s-up>","n")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6467 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6468 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6469 if !hasmapto('<Plug>NetrwTreeSqueeze')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6470 nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6471 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6472 nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(1)<cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6473 let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6474 if g:netrw_mousemaps == 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6475 nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6476 nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6477 nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6478 nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6479 nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6480 nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6481 imap <buffer> <leftmouse> <Plug>ILeftmouse
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6482 imap <buffer> <middlemouse> <Plug>IMiddlemouse
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6483 nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6484 nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6485 nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6486 nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6487 nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6488 nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6489 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6490 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6491 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6492 exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6493 exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6494 exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6495 exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6496 exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6497 exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6498 exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6499 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6500
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6501 " support user-specified maps
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6502 call netrw#UserMaps(1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6503
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6504 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6505 " remote normal-mode maps {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6506 " call Decho("make remote maps",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6507 call s:RemotePathAnalysis(b:netrw_curdir)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6508 nnoremap <buffer> <silent> <Plug>NetrwHide_a :<c-u>call <SID>NetrwHide(0)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6509 nnoremap <buffer> <silent> <Plug>NetrwBrowseUpDir :<c-u>call <SID>NetrwBrowseUpDir(0)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6510 nnoremap <buffer> <silent> <Plug>NetrwOpenFile :<c-u>call <SID>NetrwOpenFile(0)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6511 nnoremap <buffer> <silent> <Plug>NetrwBadd_cb :<c-u>call <SID>NetrwBadd(0,0)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6512 nnoremap <buffer> <silent> <Plug>NetrwBadd_cB :<c-u>call <SID>NetrwBadd(0,1)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6513 nnoremap <buffer> <silent> <Plug>NetrwLcd :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6514 nnoremap <buffer> <silent> <Plug>NetrwSetChgwin :<c-u>call <SID>NetrwSetChgwin()<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6515 nnoremap <buffer> <silent> <Plug>NetrwRefresh :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6516 nnoremap <buffer> <silent> <Plug>NetrwLocalBrowseCheck :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6517 nnoremap <buffer> <silent> <Plug>NetrwServerEdit :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6518 nnoremap <buffer> <silent> <Plug>NetrwBookHistHandler_gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr>
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6519 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6520 nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6521 nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6522 nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6523 nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6524 nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6525 nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6526 nnoremap <buffer> <silent> <nowait> ma :<c-u>call <SID>NetrwMarkFileArgList(0,0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6527 nnoremap <buffer> <silent> <nowait> mA :<c-u>call <SID>NetrwMarkFileArgList(0,1)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6528 nnoremap <buffer> <silent> <nowait> mb :<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6529 nnoremap <buffer> <silent> <nowait> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6530 nnoremap <buffer> <silent> <nowait> mc :<c-u>call <SID>NetrwMarkFileCopy(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6531 nnoremap <buffer> <silent> <nowait> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6532 nnoremap <buffer> <silent> <nowait> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6533 nnoremap <buffer> <silent> <nowait> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6534 nnoremap <buffer> <silent> <nowait> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6535 nnoremap <buffer> <silent> <nowait> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6536 nnoremap <buffer> <silent> <nowait> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6537 nnoremap <buffer> <silent> <nowait> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6538 nnoremap <buffer> <silent> <nowait> mp :<c-u>call <SID>NetrwMarkFilePrint(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6539 nnoremap <buffer> <silent> <nowait> mr :<c-u>call <SID>NetrwMarkFileRegexp(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6540 nnoremap <buffer> <silent> <nowait> ms :<c-u>call <SID>NetrwMarkFileSource(0)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6541 nnoremap <buffer> <silent> <nowait> mT :<c-u>call <SID>NetrwMarkFileTag(0)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6542 nnoremap <buffer> <silent> <nowait> mt :<c-u>call <SID>NetrwMarkFileTgt(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6543 nnoremap <buffer> <silent> <nowait> mu :<c-u>call <SID>NetrwUnMarkFile(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6544 nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6545 nnoremap <buffer> <silent> <nowait> mx :<c-u>call <SID>NetrwMarkFileExe(0,0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6546 nnoremap <buffer> <silent> <nowait> mX :<c-u>call <SID>NetrwMarkFileExe(0,1)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6547 nnoremap <buffer> <silent> <nowait> mz :<c-u>call <SID>NetrwMarkFileCompress(0)<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6548 nnoremap <buffer> <silent> <nowait> O :<c-u>call <SID>NetrwObtain(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6549 nnoremap <buffer> <silent> <nowait> o :call <SID>NetrwSplit(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6550 nnoremap <buffer> <silent> <nowait> p :<c-u>call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6551 nnoremap <buffer> <silent> <nowait> P :<c-u>call <SID>NetrwPrevWinOpen(0)<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6552 nnoremap <buffer> <silent> <nowait> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6553 nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6554 nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6555 nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr>
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
6556 nnoremap <buffer> <silent> <nowait> r :<c-u>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>
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6557 nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6558 nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(0)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6559 nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(0,'b',v:count1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6560 nnoremap <buffer> <silent> <nowait> t :call <SID>NetrwSplit(1)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6561 nnoremap <buffer> <silent> <nowait> Th :<c-u>call <SID>NetrwSetTgt(0,'h',v:count)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6562 nnoremap <buffer> <silent> <nowait> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6563 nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6564 nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr>
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6565 nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6566 if !hasmapto('<Plug>NetrwHideEdit')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6567 nmap <buffer> <c-h> <Plug>NetrwHideEdit
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6568 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6569 nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr>
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6570 if !hasmapto('<Plug>NetrwRefresh')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6571 nmap <buffer> <c-l> <Plug>NetrwRefresh
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6572 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6573 if !hasmapto('<Plug>NetrwTreeSqueeze')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6574 nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6575 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6576 nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(0)<cr>
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6577
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6578 let mapsafepath = escape(s:path, s:netrw_map_escape)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6579 let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6580
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6581 nnoremap <buffer> <silent> <Plug>NetrwRefresh :call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr>
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6582 if g:netrw_mousemaps == 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6583 nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6584 nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6585 nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6586 nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6587 nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6588 nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6589 nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6590 nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6591 nmap <middlemouse> <Plug>NetrwMiddlemouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6592 nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr>
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6593 nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6594 nmap <buffer> <silent> <Plug>Netrw2Leftmouse -
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6595 imap <buffer> <leftmouse> <Plug>ILeftmouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6596 imap <buffer> <middlemouse> <Plug>IMiddlemouse
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6597 imap <buffer> <s-leftmouse> <Plug>ISLeftmouse
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6598 exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6599 exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6600 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6601 exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6602 exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6603 exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6604 exe 'nnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6605 exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6606 exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6607 exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6608 nnoremap <buffer> <F1> :he netrw-quickhelp<cr>
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6609
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6610 " support user-specified maps
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6611 call netrw#UserMaps(0)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6612 endif " }}}3
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6613
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6614 " call Dret("s:NetrwMaps")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6615 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6616
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6617 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6618 " s:NetrwCommands: set up commands {{{2
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6619 " If -buffer, the command is only available from within netrw buffers
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6620 " Otherwise, the command is available from any window, so long as netrw
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6621 " has been used at least once in the session.
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6622 fun! s:NetrwCommands(islocal)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6623 " call Dfunc("s:NetrwCommands(islocal=".a:islocal.")")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6624
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6625 com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(<bang>0,<f-args>)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6626 com! -nargs=* NetrwC call s:NetrwSetChgwin(<q-args>)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6627 com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"win#".winnr()." not a former netrw window",79)|endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6628 if a:islocal
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6629 com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,<f-args>)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6630 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6631 com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,<f-args>)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6632 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6633 com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget(<q-args>)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6634
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6635 " call Dret("s:NetrwCommands")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6636 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6637
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6638 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6639 " s:NetrwMarkFiles: apply s:NetrwMarkFile() to named file(s) {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6640 " glob()ing only works with local files
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6641 fun! s:NetrwMarkFiles(islocal,...)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6642 " call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6643 let curdir = s:NetrwGetCurdir(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6644 let i = 1
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6645 while i <= a:0
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6646 if a:islocal
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
6647 if v:version > 704 || (v:version == 704 && has("patch656"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
6648 let mffiles= glob(fnameescape(a:{i}),0,1,1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
6649 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
6650 let mffiles= glob(fnameescape(a:{i}),0,1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6651 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6652 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6653 let mffiles= [a:{i}]
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6654 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6655 " call Decho("mffiles".string(mffiles),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6656 for mffile in mffiles
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6657 " call Decho("mffile<".mffile.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6658 call s:NetrwMarkFile(a:islocal,mffile)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6659 endfor
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6660 let i= i + 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6661 endwhile
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6662 " call Dret("s:NetrwMarkFiles")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6663 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6664
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6665 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6666 " s:NetrwMarkTarget: implements :MT (mark target) {{{2
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6667 fun! s:NetrwMarkTarget(...)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6668 " call Dfunc("s:NetrwMarkTarget() a:0=".a:0)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6669 if a:0 == 0 || (a:0 == 1 && a:1 == "")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6670 let curdir = s:NetrwGetCurdir(1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6671 let tgt = b:netrw_curdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6672 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6673 let curdir = s:NetrwGetCurdir((a:1 =~ '^\a\{3,}://')? 0 : 1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6674 let tgt = a:1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6675 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6676 " call Decho("tgt<".tgt.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6677 let s:netrwmftgt = tgt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6678 let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6679 let curislocal = b:netrw_curdir !~ '^\a\{3,}://'
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6680 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6681 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6682 call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6683 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6684 call winrestview(svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6685 " call Dret("s:NetrwMarkTarget")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6686 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6687
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6688 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6689 " s:NetrwMarkFile: (invoked by mf) This function is used to both {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6690 " mark and unmark files. If a markfile list exists,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6691 " then the rename and delete functions will use it instead
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6692 " of whatever may happen to be under the cursor at that
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6693 " moment. When the mouse and gui are available,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6694 " shift-leftmouse may also be used to mark files.
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6695 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6696 " Creates two lists
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6697 " s:netrwmarkfilelist -- holds complete paths to all marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6698 " 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
6699 "
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6700 " Creates a marked file match string
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6701 " s:netrwmarfilemtch_# -- used with 2match to display marked files
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
6702 "
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
6703 " Creates a buffer version of islocal
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
6704 " b:netrw_islocal
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6705 fun! s:NetrwMarkFile(islocal,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6706 " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6707 " call Decho("bufnr(%)=".bufnr("%").": ".bufname("%"),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6708
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6709 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6710 if empty(a:fname)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6711 " call Dret("s:NetrwMarkFile : emtpy fname")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6712 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6713 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6714 let curdir = s:NetrwGetCurdir(a:islocal)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6715
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6716 let ykeep = @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6717 let curbufnr= bufnr("%")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6718 if a:fname =~ '^\a'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6719 let leader= '\<'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6720 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6721 let leader= ''
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6722 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6723 if a:fname =~ '\a$'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6724 let trailer = '\>[@=|\/\*]\=\ze\%( \|\t\|$\)'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6725 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6726 let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6727 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6728
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6729 if exists("s:netrwmarkfilelist_".curbufnr)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6730 " markfile list pre-exists
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6731 " call Decho("case s:netrwmarkfilelist_".curbufnr." already exists",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6732 " call Decho("starting s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6733 " call Decho("starting s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>"))
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
6734 let b:netrw_islocal= a:islocal
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6735
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6736 if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
6737 " append filename to buffer's markfilelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6738 " call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6739 call add(s:netrwmarkfilelist_{curbufnr},a:fname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6740 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(a:fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6741
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6742 else
1702
5232b9862f23 updated for version 7.2-000
vimboss
parents: 1698
diff changeset
6743 " remove filename from buffer's markfilelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6744 " call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6745 call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6746 if s:netrwmarkfilelist_{curbufnr} == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6747 " local markfilelist is empty; remove it entirely
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6748 " call Decho("markfile list now empty",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6749 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6750 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6751 " rebuild match list to display markings correctly
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6752 " call Decho("rebuild s:netrwmarkfilemtch_".curbufnr,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6753 let s:netrwmarkfilemtch_{curbufnr}= ""
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6754 let first = 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6755 for fname in s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6756 if first
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6757 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.leader.escape(fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6758 else
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6759 let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6760 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6761 let first= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6762 endfor
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6763 " call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6764 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6765 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6766
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6767 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6768 " initialize new markfilelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6769 " call Decho("case: initialize new markfilelist",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6770
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6771 " call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6772 let s:netrwmarkfilelist_{curbufnr}= []
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6773 call add(s:netrwmarkfilelist_{curbufnr},substitute(a:fname,'[|@]$','',''))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6774 " call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6775
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6776 " build initial markfile matching pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6777 if a:fname =~ '/$'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6778 let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6779 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
6780 let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc).trailer
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6781 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6782 " call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("<slnum>"))
1621
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6785 " handle global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6786 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6787 let dname= s:ComposePath(b:netrw_curdir,a:fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6788 if index(s:netrwmarkfilelist,dname) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6789 " append new filename to global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6790 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6791 " call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6792 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6793 " remove new filename from global markfilelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6794 " call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6795 call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6796 " call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6797 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6798 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6799 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6800 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6801 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6802 " initialize new global-directory markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6803 let s:netrwmarkfilelist= []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6804 call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6805 " call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6806 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6807
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6808 " set up 2match'ing to netrwmarkfilemtch_# list
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6809 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6810 if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6811 " " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6812 if exists("g:did_drchip_netrwlist_syntax")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6813 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6814 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6815 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6816 " " call Decho("2match none",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6817 2match none
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6818 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6819 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6820 let @@= ykeep
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
6821 " call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6822 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6823
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6824 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6825 " s:NetrwMarkFileArgList: ma: move the marked file list to the argument list (tomflist=0) {{{2
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6826 " mA: move the argument list to marked file list (tomflist=1)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6827 " Uses the global marked file list
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6828 fun! s:NetrwMarkFileArgList(islocal,tomflist)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6829 " call Dfunc("s:NetrwMarkFileArgList(islocal=".a:islocal.",tomflist=".a:tomflist.")")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6830
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6831 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6832 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6833 let curdir = s:NetrwGetCurdir(a:islocal)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6834 let curbufnr = bufnr("%")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6835
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6836 if a:tomflist
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6837 " mA: move argument list to marked file list
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6838 while argc()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6839 let fname= argv(0)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6840 " call Decho("exe argdel ".fname,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6841 exe "argdel ".fnameescape(fname)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6842 call s:NetrwMarkFile(a:islocal,fname)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6843 endwhile
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6844
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6845 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6846 " ma: move marked file list to argument list
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6847 if exists("s:netrwmarkfilelist")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6848
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6849 " for every filename in the marked list
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6850 for fname in s:netrwmarkfilelist
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6851 " call Decho("exe argadd ".fname,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6852 exe "argadd ".fnameescape(fname)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6853 endfor " for every file in the marked list
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6854
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6855 " unmark list and refresh
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6856 call s:NetrwUnmarkList(curbufnr,curdir)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6857 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6858 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6859 NetrwKeepj call winrestview(svpos)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6860 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6861 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6862
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6863 " call Dret("s:NetrwMarkFileArgList")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6864 endfun
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6865
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6866 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6867 " s:NetrwMarkFileCompress: (invoked by mz) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6868 " compress/decompress files using the programs
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6869 " in g:netrw_compress and g:netrw_uncompress,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6870 " using g:netrw_compress_suffix to know which to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6871 " do. By default:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6872 " g:netrw_compress = "gzip"
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
6873 " 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
6874 fun! s:NetrwMarkFileCompress(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6875 " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6876 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6877 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6878 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6879 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6880
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6881 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6882 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6883 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6884 " call Dret("s:NetrwMarkFileCompress")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6885 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6886 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6887 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6888
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6889 if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6890
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6891 " for every filename in the marked list
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6892 for fname in s:netrwmarkfilelist_{curbufnr}
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6893 let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6894 " call Decho("extracted sfx<".sfx.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6895 if exists("g:netrw_decompress['".sfx."']")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6896 " fname has a suffix indicating that its compressed; apply associated decompression routine
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6897 let exe= g:netrw_decompress[sfx]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6898 " call Decho("fname<".fname."> is compressed so decompress with <".exe.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6899 let exe= netrw#WinPath(exe)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6900 if a:islocal
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6901 if g:netrw_keepdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6902 let fname= s:ShellEscape(s:ComposePath(curdir,fname))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6903 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6904 call system(exe." ".fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6905 if v:shell_error
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6906 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6907 endif
13030
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
6908 else
92a0a33f8296 move netrw back to the previous version
Christian Brabandt <cb@256bit.org>
parents: 12785
diff changeset
6909 let fname= s:ShellEscape(b:netrw_curdir.fname,1)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6910 NetrwKeepj call s:RemoteSystem(exe." ".fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6911 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6912
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6913 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6914 unlet sfx
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6915
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6916 if exists("exe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6917 unlet exe
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6918 elseif a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6919 " fname not a compressed file, so compress it
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6920 call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname)))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6921 if v:shell_error
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6922 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_compress<".g:netrw_compress."> to something that works",104)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6923 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6924 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6925 " fname not a compressed file, so compress it
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6926 NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6927 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6928 endfor " for every file in the marked list
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6929
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6930 call s:NetrwUnmarkList(curbufnr,curdir)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6931 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6932 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6933 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6934 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6935 " call Dret("s:NetrwMarkFileCompress")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6936 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6937
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6938 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6939 " s:NetrwMarkFileCopy: (invoked by mc) copy marked files to target {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6940 " If no marked files, then set up directory as the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6941 " target. Currently does not support copying entire
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6942 " directories. Uses the local-buffer marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6943 " Returns 1=success (used by NetrwMarkFileMove())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6944 " 0=failure
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6945 fun! s:NetrwMarkFileCopy(islocal,...)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6946 " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6947
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6948 let curdir = s:NetrwGetCurdir(a:islocal)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6949 let curbufnr = bufnr("%")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6950 if b:netrw_curdir !~ '/$'
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6951 if !exists("b:netrw_curdir")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6952 let b:netrw_curdir= curdir
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6953 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6954 let b:netrw_curdir= b:netrw_curdir."/"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6955 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6956
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6957 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6958 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6959 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6960 " call Dret("s:NetrwMarkFileCopy")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6961 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6962 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6963 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
6964
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6965 if !exists("s:netrwmftgt")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
6966 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6967 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6968 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6969 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6970 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6971
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6972 if a:islocal && s:netrwmftgt_islocal
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
6973 " Copy marked files, local directory to local directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6974 " call Decho("copy from local to local",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
6975 if !executable(g:netrw_localcopycmd)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6976 call netrw#ErrorMsg(s:ERROR,"g:netrw_localcopycmd<".g:netrw_localcopycmd."> not executable on your system, aborting",91)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6977 " call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6978 return
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
6979 endif
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6980
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6981 " copy marked files while within the same directory (ie. allow renaming)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6982 if simplify(s:netrwmftgt) == simplify(b:netrw_curdir)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6983 if len(s:netrwmarkfilelist_{bufnr('%')}) == 1
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6984 " only one marked file
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6985 " call Decho("case: only one marked file",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6986 let args = s:ShellEscape(b:netrw_curdir.s:netrwmarkfilelist_{bufnr('%')}[0])
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6987 let oldname = s:netrwmarkfilelist_{bufnr('%')}[0]
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6988 elseif a:0 == 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6989 " call Decho("case: handling one input argument",'~'.expand("<slnum>"))
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6990 " this happens when the next case was used to recursively call s:NetrwMarkFileCopy()
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
6991 let args = s:ShellEscape(b:netrw_curdir.a:1)
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6992 let oldname = a:1
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6993 else
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6994 " copy multiple marked files inside the same directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
6995 " call Decho("case: handling a multiple marked files",'~'.expand("<slnum>"))
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6996 let s:recursive= 1
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6997 for oldname in s:netrwmarkfilelist_{bufnr("%")}
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6998 let ret= s:NetrwMarkFileCopy(a:islocal,oldname)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
6999 if ret == 0
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7000 break
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7001 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7002 endfor
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7003 unlet s:recursive
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7004 call s:NetrwUnmarkList(curbufnr,curdir)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7005 " call Dret("s:NetrwMarkFileCopy ".ret)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7006 return ret
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7007 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7008
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7009 call inputsave()
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7010 let newname= input("Copy ".oldname." to : ",oldname,"file")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7011 call inputrestore()
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7012 if newname == ""
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7013 " call Dret("s:NetrwMarkFileCopy 0")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7014 return 0
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7015 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7016 let args= s:ShellEscape(oldname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7017 let tgt = s:ShellEscape(s:netrwmftgt.'/'.newname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7018 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7019 let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7020 let tgt = s:ShellEscape(s:netrwmftgt)
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7021 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7022 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7023 let args= substitute(args,'/','\\','g')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7024 let tgt = substitute(tgt, '/','\\','g')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7025 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7026 if args =~ "'" |let args= substitute(args,"'\\(.*\\)'",'\1','')|endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7027 if tgt =~ "'" |let tgt = substitute(tgt ,"'\\(.*\\)'",'\1','')|endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7028 if args =~ '//'|let args= substitute(args,'//','/','g')|endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7029 if tgt =~ '//'|let tgt = substitute(tgt ,'//','/','g')|endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7030 " call Decho("args <".args.">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7031 " call Decho("tgt <".tgt.">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7032 if isdirectory(s:NetrwFile(args))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7033 " call Decho("args<".args."> is a directory",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7034 let copycmd= g:netrw_localcopydircmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7035 " call Decho("using copydircmd<".copycmd.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7036 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7037 " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7038 " contents to a target. One must append the source directory name to the target to get xcopy to
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7039 " do the right thing.
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7040 let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7041 " call Decho("modified tgt for xcopy",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7042 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7043 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7044 let copycmd= g:netrw_localcopycmd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7045 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7046 if g:netrw_localcopycmd =~ '\s'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7047 let copycmd = substitute(copycmd,'\s.*$','','')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7048 let copycmdargs = substitute(copycmd,'^.\{-}\(\s.*\)$','\1','')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7049 let copycmd = netrw#WinPath(copycmd).copycmdargs
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7050 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7051 let copycmd = netrw#WinPath(copycmd)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7052 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7053 " call Decho("args <".args.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7054 " call Decho("tgt <".tgt.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7055 " call Decho("copycmd<".copycmd.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7056 " call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7057 call system(copycmd.g:netrw_localcopycmdopt." '".args."' '".tgt."'")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7058 if v:shell_error != 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7059 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7060 call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",101)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7061 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7062 call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7063 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7064 " call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".s:ShellEscape(s:netrwmftgt))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7065 return 0
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7066 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7067
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7068 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7069 " Copy marked files, local directory to remote directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7070 " call Decho("copy from local to remote",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7071 NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7072
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7073 elseif !a:islocal && s:netrwmftgt_islocal
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7074 " Copy marked files, remote directory to local directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7075 " call Decho("copy from remote to local",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7076 NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7077
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7078 elseif !a:islocal && !s:netrwmftgt_islocal
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7079 " Copy marked files, remote directory to remote directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7080 " call Decho("copy from remote to remote",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7081 let curdir = getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7082 let tmpdir = s:GetTempfile("")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7083 if tmpdir !~ '/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7084 let tmpdir= curdir."/".tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7085 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7086 if exists("*mkdir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7087 call mkdir(tmpdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7088 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7089 call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(tmpdir,1))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7090 if v:shell_error != 0
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7091 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7092 " call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) )
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7093 return
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7094 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7095 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7096 if isdirectory(s:NetrwFile(tmpdir))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7097 if s:NetrwLcd(tmpdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7098 " call Dret("s:NetrwMarkFileCopy : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7099 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7100 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7101 NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7102 let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7103 NetrwKeepj call s:NetrwUpload(localfiles,s:netrwmftgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7104 if getcwd() == tmpdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7105 for fname in s:netrwmarkfilelist_{bufnr('%')}
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7106 NetrwKeepj call s:NetrwDelete(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7107 endfor
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7108 if s:NetrwLcd(curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7109 " call Dret("s:NetrwMarkFileCopy : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7110 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7111 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7112 if v:version < 704 || (v:version == 704 && !has("patch1107"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7113 call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7114 if v:shell_error != 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7115 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7116 " " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) )
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7117 return
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7118 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7119 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7120 if delete(tmpdir,"d")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7121 call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".tmpdir.">!",103)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7122 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7123 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7124 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7125 if s:NetrwLcd(curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7126 " call Dret("s:NetrwMarkFileCopy : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7127 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7128 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7129 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7130 endif
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
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7133 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7134 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7135 " -------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7136 " call Decho("cleanup",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
7137 " remove markings from local buffer
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
7138 call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7139 " call Decho(" g:netrw_fastbrowse =".g:netrw_fastbrowse,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7140 " call Decho(" s:netrwmftgt =".s:netrwmftgt,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7141 " call Decho(" s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7142 " call Decho(" curdir =".curdir,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7143 " call Decho(" a:islocal =".a:islocal,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7144 " call Decho(" curbufnr =".curbufnr,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7145 if exists("s:recursive")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7146 " call Decho(" s:recursive =".s:recursive,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7147 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7148 " call Decho(" s:recursive =n/a",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7149 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7150 " see s:LocalFastBrowser() for g:netrw_fastbrowse interpretation (refreshing done for both slow and medium)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7151 if g:netrw_fastbrowse <= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7152 NetrwKeepj call s:LocalBrowseRefresh()
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7153 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7154 " refresh local and targets for fast browsing
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7155 if !exists("s:recursive")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7156 " remove markings from local buffer
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7157 " call Decho(" remove markings from local buffer",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7158 NetrwKeepj call s:NetrwUnmarkList(curbufnr,curdir)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7159 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7160
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7161 " refresh buffers
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7162 if s:netrwmftgt_islocal
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7163 " call Decho(" refresh s:netrwmftgt=".s:netrwmftgt,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7164 NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7165 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7166 if a:islocal && s:netrwmftgt != curdir
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7167 " call Decho(" refresh curdir=".curdir,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7168 NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7169 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7170 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7171
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7172 " call Dret("s:NetrwMarkFileCopy 1")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7173 return 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7174 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7175
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7176 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7177 " s:NetrwMarkFileDiff: (invoked by md) This function is used to {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7178 " invoke vim's diff mode on the marked files.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7179 " Either two or three files can be so handled.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7180 " Uses the global marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7181 fun! s:NetrwMarkFileDiff(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7182 " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7183 let curbufnr= bufnr("%")
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7184
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7185 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7186 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7187 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7188 " call Dret("s:NetrwMarkFileDiff")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7189 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7190 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7191 let curdir= s:NetrwGetCurdir(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7192 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7193
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
7194 if exists("s:netrwmarkfilelist_{".curbufnr."}")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7195 let cnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7196 for fname in s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7197 let cnt= cnt + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7198 if cnt == 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7199 " call Decho("diffthis: fname<".fname.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7200 exe "NetrwKeepj e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7201 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7202 elseif cnt == 2 || cnt == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7203 vsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7204 wincmd l
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7205 " call Decho("diffthis: ".fname,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7206 exe "NetrwKeepj e ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7207 diffthis
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7208 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7209 break
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7210 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7211 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7212 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7213 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7214
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7215 " call Dret("s:NetrwMarkFileDiff")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7216 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7217
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7218 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7219 " 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
7220 " Uses global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7221 fun! s:NetrwMarkFileEdit(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7222 " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7223
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7224 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7225 let curbufnr = bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7226
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7227 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7228 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7229 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7230 " call Dret("s:NetrwMarkFileEdit")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7231 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7232 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7233 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7234
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7235 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7236 call s:SetRexDir(a:islocal,curdir)
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7237 let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7238 " unmark markedfile list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7239 " call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7240 call s:NetrwUnmarkAll()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7241 " call Decho("exe sil args ".flist,'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
7242 exe "sil args ".flist
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7243 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7244 echo "(use :bn, :bp to navigate files; :Rex to return)"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7245
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7246 " call Dret("s:NetrwMarkFileEdit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7247 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7248
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7249 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7250 " s:NetrwMarkFileQFEL: convert a quickfix-error or location list into a marked file list {{{2
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7251 fun! s:NetrwMarkFileQFEL(islocal,qfel)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7252 " call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7253 call s:NetrwUnmarkAll()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7254 let curbufnr= bufnr("%")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7255
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7256 if !empty(a:qfel)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7257 for entry in a:qfel
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7258 let bufnmbr= entry["bufnr"]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7259 " call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"],'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7260 if !exists("s:netrwmarkfilelist_{curbufnr}")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7261 " call Decho("case: no marked file list",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7262 call s:NetrwMarkFile(a:islocal,bufname(bufnmbr))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7263 elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7264 " s:NetrwMarkFile will remove duplicate entries from the marked file list.
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7265 " So, this test lets two or more hits on the same pattern to be ignored.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7266 " call Decho("case: ".bufname(bufnmbr)." not currently in marked file list",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7267 call s:NetrwMarkFile(a:islocal,bufname(bufnmbr))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7268 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7269 " call Decho("case: ".bufname(bufnmbr)." already in marked file list",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7270 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7271 endfor
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7272 echo "(use me to edit marked files)"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7273 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7274 call netrw#ErrorMsg(s:WARNING,"can't convert quickfix error list; its empty!",92)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7275 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7276
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7277 " call Dret("s:NetrwMarkFileQFEL")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7278 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7279
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7280 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7281 " s:NetrwMarkFileExe: (invoked by mx and mX) execute arbitrary system command on marked files {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7282 " mx enbloc=0: Uses the local marked-file list, applies command to each file individually
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7283 " mX enbloc=1: Uses the global marked-file list, applies command to entire list
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7284 fun! s:NetrwMarkFileExe(islocal,enbloc)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7285 " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7286 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7287 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7288 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7289 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7290
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7291 if a:enbloc == 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7292 " individually apply command to files, one at a time
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7293 " sanity check
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7294 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7295 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7296 " call Dret("s:NetrwMarkFileExe")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7297 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7298 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7299 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7300
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7301 if exists("s:netrwmarkfilelist_{curbufnr}")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7302 " get the command
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7303 call inputsave()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7304 let cmd= input("Enter command: ","","file")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7305 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7306 " call Decho("cmd<".cmd.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7307 if cmd == ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7308 " call Dret("s:NetrwMarkFileExe : early exit, empty command")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7309 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7310 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7311
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7312 " apply command to marked files, individually. Substitute: filename -> %
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7313 " If no %, then append a space and the filename to the command
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7314 for fname in s:netrwmarkfilelist_{curbufnr}
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7315 if a:islocal
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7316 if g:netrw_keepdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7317 let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname)))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7318 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7319 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7320 let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7321 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7322 if cmd =~ '%'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7323 let xcmd= substitute(cmd,'%',fname,'g')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7324 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7325 let xcmd= cmd.' '.fname
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7326 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7327 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7328 " call Decho("local: xcmd<".xcmd.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7329 let ret= system(xcmd)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7330 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7331 " call Decho("remote: xcmd<".xcmd.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7332 let ret= s:RemoteSystem(xcmd)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7333 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7334 if v:shell_error < 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7335 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7336 break
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7337 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7338 echo ret
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7339 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7340 endfor
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7341
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7342 " unmark marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7343 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7344
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7345 " refresh the listing
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7346 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7347 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7348 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7349 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7350 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7351 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7352
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7353 else " apply command to global list of files, en bloc
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7354
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7355 call inputsave()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7356 let cmd= input("Enter command: ","","file")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7357 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7358 " call Decho("cmd<".cmd.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7359 if cmd == ""
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7360 " call Dret("s:NetrwMarkFileExe : early exit, empty command")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7361 return
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7362 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7363 if cmd =~ '%'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7364 let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' '),'g')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7365 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7366 let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' ')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7367 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7368 if a:islocal
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7369 call system(cmd)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7370 if v:shell_error < 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7371 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7372 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7373 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7374 let ret= s:RemoteSystem(cmd)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7375 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7376 call s:NetrwUnmarkAll()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7377
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7378 " refresh the listing
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7379 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7380 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7381 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7382
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7383 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7384
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7385 " call Dret("s:NetrwMarkFileExe")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7386 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7387
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7388 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7389 " s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7390 " as the marked file(s) (toggles suffix presence)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7391 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7392 fun! s:NetrwMarkHideSfx(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7393 " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7394 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7395 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7396 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7397
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7398 " s:netrwmarkfilelist_{curbufnr}: the List of marked files
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7399 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7400
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7401 for fname in s:netrwmarkfilelist_{curbufnr}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7402 " call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7403 " construct suffix pattern
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7404 if fname =~ '\.'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7405 let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7406 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7407 let sfxpat= '^\%(\%(\.\)\@!.\)*$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7408 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7409 " determine if its in the hiding list or not
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7410 let inhidelist= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7411 if g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7412 let itemnum = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7413 let hidelist= split(g:netrw_list_hide,',')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7414 for hidepat in hidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7415 if sfxpat == hidepat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7416 let inhidelist= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7417 break
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 let itemnum= itemnum + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7420 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7421 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7422 " call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7423 if inhidelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7424 " remove sfxpat from list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7425 call remove(hidelist,itemnum)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7426 let g:netrw_list_hide= join(hidelist,",")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7427 elseif g:netrw_list_hide != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7428 " append sfxpat to non-empty list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7429 let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7430 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7431 " set hiding list to sfxpat
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7432 let g:netrw_list_hide= sfxpat
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 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7435
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7436 " refresh the listing
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7437 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7438 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7439 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7440 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7441 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7442 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7443
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7444 " call Dret("s:NetrwMarkHideSfx")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7445 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7446
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7447 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7448 " s:NetrwMarkFileVimCmd: (invoked by mv) execute arbitrary vim command on marked files, one at a time {{{2
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7449 " Uses the local marked-file list.
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7450 fun! s:NetrwMarkFileVimCmd(islocal)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7451 " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7452 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7453 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7454 let curdir = s:NetrwGetCurdir(a:islocal)
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7455 let curbufnr = bufnr("%")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7456
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7457 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7458 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7459 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7460 " call Dret("s:NetrwMarkFileVimCmd")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7461 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7462 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7463 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7464
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7465 if exists("s:netrwmarkfilelist_{curbufnr}")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7466 " get the command
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7467 call inputsave()
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7468 let cmd= input("Enter vim command: ","","file")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7469 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7470 " call Decho("cmd<".cmd.">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7471 if cmd == ""
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7472 " " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7473 return
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7474 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7475
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7476 " apply command to marked files. Substitute: filename -> %
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7477 " If no %, then append a space and the filename to the command
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7478 for fname in s:netrwmarkfilelist_{curbufnr}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7479 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7480 if a:islocal
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7481 1split
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7482 exe "sil! NetrwKeepj keepalt e ".fnameescape(fname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7483 " call Decho("local<".fname.">: exe ".cmd,'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7484 exe cmd
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7485 exe "sil! keepalt wq!"
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7486 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7487 " call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7488 echo "sorry, \"mv\" not supported yet for remote files"
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7489 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7490 endfor
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7491
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7492 " unmark marked file list
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7493 call s:NetrwUnmarkList(curbufnr,curdir)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7494
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7495 " refresh the listing
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7496 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7497 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7498 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7499 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7500 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7501 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7502
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7503 " call Dret("s:NetrwMarkFileVimCmd")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7504 endfun
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7505
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7506 " ---------------------------------------------------------------------
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7507 " s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7508 " as the marked file(s) (toggles suffix presence)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7509 " Uses the local marked file list.
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7510 fun! s:NetrwMarkHideSfx(islocal)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7511 " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7512 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7513 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7514 let curbufnr = bufnr("%")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7515
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7516 " s:netrwmarkfilelist_{curbufnr}: the List of marked files
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7517 if exists("s:netrwmarkfilelist_{curbufnr}")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7518
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7519 for fname in s:netrwmarkfilelist_{curbufnr}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7520 " call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7521 " construct suffix pattern
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7522 if fname =~ '\.'
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7523 let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','')
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7524 else
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7525 let sfxpat= '^\%(\%(\.\)\@!.\)*$'
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7526 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7527 " determine if its in the hiding list or not
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7528 let inhidelist= 0
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7529 if g:netrw_list_hide != ""
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7530 let itemnum = 0
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7531 let hidelist= split(g:netrw_list_hide,',')
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7532 for hidepat in hidelist
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7533 if sfxpat == hidepat
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7534 let inhidelist= 1
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7535 break
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7536 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7537 let itemnum= itemnum + 1
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7538 endfor
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7539 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7540 " call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7541 if inhidelist
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7542 " remove sfxpat from list
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7543 call remove(hidelist,itemnum)
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7544 let g:netrw_list_hide= join(hidelist,",")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7545 elseif g:netrw_list_hide != ""
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7546 " append sfxpat to non-empty list
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7547 let g:netrw_list_hide= g:netrw_list_hide.",".sfxpat
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7548 else
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7549 " set hiding list to sfxpat
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7550 let g:netrw_list_hide= sfxpat
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7551 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7552 endfor
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7553
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7554 " refresh the listing
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7555 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7556 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7557 NetrwKeepj call winrestview(svpos)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7558 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7559 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59)
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7560 endif
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7561
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7562 " call Dret("s:NetrwMarkHideSfx")
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7563 endfun
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7564
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
7565 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7566 " s:NetrwMarkFileGrep: (invoked by mg) This function applies vimgrep to marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7567 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7568 fun! s:NetrwMarkFileGrep(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7569 " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7570 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7571 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7572 let curbufnr = bufnr("%")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7573 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7574
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7575 if exists("s:netrwmarkfilelist")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7576 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
7577 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7578 call s:NetrwUnmarkAll()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7579 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7580 " call Decho('no marked files, using "*"','~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7581 let netrwmarkfilelist= "*"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7582 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7583
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7584 " ask user for pattern
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7585 call inputsave()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7586 let pat= input("Enter pattern: ","")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7587 call inputrestore()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7588 let patbang = ""
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7589 if pat =~ '^!'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7590 let patbang = "!"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7591 let pat = strpart(pat,2)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7592 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7593 if pat =~ '^\i'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7594 let pat = escape(pat,'/')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7595 let pat = '/'.pat.'/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7596 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7597 let nonisi = pat[0]
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7598 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7599
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7600 " use vimgrep for both local and remote
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7601 " call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7602 try
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7603 exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7604 catch /^Vim\%((\a\+)\)\=:E480/
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7605 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7606 " call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7607 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7608 endtry
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7609 echo "(use :cn, :cp to navigate, :Rex to return)"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7610
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7611 2match none
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7612 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7613 NetrwKeepj call winrestview(svpos)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7614
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7615 if exists("nonisi")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7616 " original, user-supplied pattern did not begin with a character from isident
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7617 " call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
7618 if pat =~# nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$'
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7619 call s:NetrwMarkFileQFEL(a:islocal,getqflist())
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7620 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7621 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7622
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7623 " call Dret("s:NetrwMarkFileGrep")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7624 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7625
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7626 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7627 " 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
7628 " uses the global marked file list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7629 " s:netrwmfloc= 0: target directory is remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7630 " = 1: target directory is local
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7631 fun! s:NetrwMarkFileMove(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7632 " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7633 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7634 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7635
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7636 " sanity check
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7637 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7638 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7639 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7640 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7641 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7642 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7643
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7644 if !exists("s:netrwmftgt")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7645 NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7646 " call Dret("s:NetrwMarkFileCopy 0")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7647 return 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7648 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7649 " call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7650
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7651 if a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7652 " move: local -> local
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7653 " call Decho("move from local to local",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7654 " call Decho("local to local move",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7655 if !executable(g:netrw_localmovecmd)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7656 call netrw#ErrorMsg(s:ERROR,"g:netrw_localmovecmd<".g:netrw_localmovecmd."> not executable on your system, aborting",90)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7657 " call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7658 return
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7659 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7660 let tgt = s:ShellEscape(s:netrwmftgt)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7661 " call Decho("tgt<".tgt.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7662 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7663 let tgt= substitute(tgt, '/','\\','g')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7664 " call Decho("windows exception: tgt<".tgt.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7665 if g:netrw_localmovecmd =~ '\s'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7666 let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7667 let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7668 let movecmd = netrw#WinPath(movecmd).movecmdargs
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7669 " call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7670 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7671 let movecmd = netrw#WinPath(movecmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7672 " call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7673 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7674 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7675 let movecmd = netrw#WinPath(g:netrw_localmovecmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7676 " call Decho("movecmd<".movecmd."> (#3 linux or cygwin)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7677 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7678 for fname in s:netrwmarkfilelist_{bufnr("%")}
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7679 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7680 let fname= substitute(fname,'/','\\','g')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7681 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7682 " call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7683 let ret= system(movecmd.g:netrw_localmovecmdopt." ".s:ShellEscape(fname)." ".tgt)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7684 if v:shell_error != 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7685 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7686 call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",100)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7687 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7688 call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7689 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7690 break
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7691 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
7692 endfor
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7693
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7694 elseif a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7695 " move: local -> remote
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7696 " call Decho("move from local to remote",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7697 " call Decho("copy",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7698 let mflist= s:netrwmarkfilelist_{bufnr("%")}
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7699 NetrwKeepj call s:NetrwMarkFileCopy(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7700 " call Decho("remove",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7701 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7702 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7703 let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7704 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7705 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7706
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7707 elseif !a:islocal && s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7708 " move: remote -> local
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7709 " call Decho("move from remote to local",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7710 " call Decho("copy",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7711 let mflist= s:netrwmarkfilelist_{bufnr("%")}
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7712 NetrwKeepj call s:NetrwMarkFileCopy(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7713 " call Decho("remove",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7714 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7715 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7716 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7717 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7718 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7719
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7720 elseif !a:islocal && !s:netrwmftgt_islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7721 " move: remote -> remote
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7722 " call Decho("move from remote to remote",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7723 " call Decho("copy",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7724 let mflist= s:netrwmarkfilelist_{bufnr("%")}
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7725 NetrwKeepj call s:NetrwMarkFileCopy(a:islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7726 " call Decho("remove",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7727 for fname in mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7728 let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7729 let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7730 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7731 unlet mflist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7732 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7733
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7734 " -------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7735 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7736 " -------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7737 " call Decho("cleanup",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7738
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7739 " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7740 call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7741
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7742 " refresh buffers
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7743 if !s:netrwmftgt_islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7744 " call Decho("refresh netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7745 NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7746 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7747 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7748 " call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7749 NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7750 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7751 if g:netrw_fastbrowse <= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7752 " call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7753 NetrwKeepj call s:LocalBrowseRefresh()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7754 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7755
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7756 " call Dret("s:NetrwMarkFileMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7757 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7758
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7759 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7760 " s:NetrwMarkFilePrint: (invoked by mp) This function prints marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7761 " using the hardcopy command. Local marked-file list only.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7762 fun! s:NetrwMarkFilePrint(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7763 " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7764 let curbufnr= bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7765
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7766 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7767 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7768 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7769 " call Dret("s:NetrwMarkFilePrint")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7770 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7771 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7772 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7773 let curdir= s:NetrwGetCurdir(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7774
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7775 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7776 let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7777 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7778 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7779 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7780 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7781 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7782 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7783 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7784 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7785 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7786 1split
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7787 " the autocmds will handle both local and remote files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7788 " call Decho("exe sil e ".escape(fname,' '),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7789 exe "sil NetrwKeepj e ".fnameescape(fname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7790 " call Decho("hardcopy",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7791 hardcopy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7792 q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7793 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7794 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7795 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7796 " call Dret("s:NetrwMarkFilePrint")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7797 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7798
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7799 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7800 " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7801 " files when given a regexp (for which a prompt is
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7802 " issued) (matches to name of files).
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7803 fun! s:NetrwMarkFileRegexp(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7804 " call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7805
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7806 " get the regular expression
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7807 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7808 let regexp= input("Enter regexp: ","","file")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7809 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7810
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7811 if a:islocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7812 let curdir= s:NetrwGetCurdir(a:islocal)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7813 " call Decho("curdir<".fnameescape(curdir).">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7814 " get the matching list of files using local glob()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7815 " call Decho("handle local regexp",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7816 let dirname = escape(b:netrw_curdir,g:netrw_glob_escape)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
7817 if v:version > 704 || (v:version == 704 && has("patch656"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7818 let filelist= glob(s:ComposePath(dirname,regexp),0,1,1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7819 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7820 let files = glob(s:ComposePath(dirname,regexp),0,0)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7821 let filelist= split(files,"\n")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7822 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7823 " call Decho("files<".string(filelist).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7824
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7825 " mark the list of files
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7826 for fname in filelist
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7827 if fname =~ '^'.fnameescape(curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7828 " call Decho("fname<".substitute(fname,'^'.fnameescape(curdir).'/','','').">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7829 NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^'.fnameescape(curdir).'/','',''))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7830 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7831 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7832 NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','',''))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7833 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7834 endfor
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7835
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7836 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7837 " call Decho("handle remote regexp",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7838
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7839 " convert displayed listing into a filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7840 let eikeep = &ei
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7841 let areg = @a
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7842 sil NetrwKeepj %y a
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
7843 setl ei=all ma
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7844 " call Decho("setl ei=all ma",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7845 1split
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7846 NetrwKeepj call s:NetrwEnew()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7847 NetrwKeepj call s:NetrwOptionsSafe(a:islocal)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7848 sil NetrwKeepj norm! "ap
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7849 NetrwKeepj 2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7850 let bannercnt= search('^" =====','W')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7851 exe "sil NetrwKeepj 1,".bannercnt."d"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
7852 setl bt=nofile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7853 if g:netrw_liststyle == s:LONGLIST
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7854 sil NetrwKeepj %s/\s\{2,}\S.*$//e
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7855 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7856 elseif g:netrw_liststyle == s:WIDELIST
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7857 sil NetrwKeepj %s/\s\{2,}/\r/ge
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7858 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7859 elseif g:netrw_liststyle == s:TREELIST
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7860 exe 'sil NetrwKeepj %s/^'.s:treedepthstring.' //e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7861 sil! NetrwKeepj g/^ .*$/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7862 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7863 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7864 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7865 " convert regexp into the more usual glob-style format
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7866 let regexp= substitute(regexp,'\*','.*','g')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7867 " call Decho("regexp<".regexp.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7868 exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
7869 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7870 let filelist= getline(1,line("$"))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7871 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7872 for filename in filelist
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7873 NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','',''))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7874 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7875 unlet filelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7876 let @a = areg
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7877 let &ei = eikeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7878 endif
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7879 echo " (use me to edit marked files)"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7880
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7881 " call Dret("s:NetrwMarkFileRegexp")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7882 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7883
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7884 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7885 " s:NetrwMarkFileSource: (invoked by ms) This function sources marked files {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7886 " Uses the local marked file list.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7887 fun! s:NetrwMarkFileSource(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7888 " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7889 let curbufnr= bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7890
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7891 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7892 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7893 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7894 " call Dret("s:NetrwMarkFileSource")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7895 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7896 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7897 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7898 let curdir= s:NetrwGetCurdir(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7899
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7900 if exists("s:netrwmarkfilelist_{curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7901 let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7902 call s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7903 for fname in netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7904 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7905 if g:netrw_keepdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7906 let fname= s:ComposePath(curdir,fname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7907 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7908 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7909 let fname= curdir.fname
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7910 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7911 " the autocmds will handle sourcing both local and remote files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7912 " call Decho("exe so ".fnameescape(fname),'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7913 exe "so ".fnameescape(fname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7914 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7915 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7916 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7917 " call Dret("s:NetrwMarkFileSource")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7918 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7919
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7920 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7921 " 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
7922 " Uses the global markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7923 fun! s:NetrwMarkFileTag(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7924 " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7925 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7926 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7927 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7928 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7929
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7930 " sanity check
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7931 if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr})
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7932 NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7933 " call Dret("s:NetrwMarkFileTag")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7934 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7935 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7936 " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7937
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7938 if exists("s:netrwmarkfilelist")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7939 " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7940 let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "s:ShellEscape(v:val,".!a:islocal.")"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7941 call s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7942
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7943 if a:islocal
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7944
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7945 " call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7946 call system(g:netrw_ctags." ".netrwmarkfilelist)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7947 if v:shell_error
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7948 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
7949 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
7950
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7951 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7952 let cmd = s:RemoteSystem(g:netrw_ctags." ".netrwmarkfilelist)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
7953 call netrw#Obtain(a:islocal,"tags")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7954 let curdir= b:netrw_curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7955 1split
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7956 NetrwKeepj e tags
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7957 let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7958 " call Decho("curdir<".curdir."> path<".path.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
7959 exe 'NetrwKeepj %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
7960 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7961 wq!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7962 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7963 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7964 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7965 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7966 call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7967 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7968
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7969 " call Dret("s:NetrwMarkFileTag")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7970 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7971
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7972 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7973 " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7974 " Sets up two variables,
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7975 " s:netrwmftgt : holds the target directory
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7976 " s:netrwmftgt_islocal : 0=target directory is remote
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7977 " 1=target directory is local
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7978 fun! s:NetrwMarkFileTgt(islocal)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7979 " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7980 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7981 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7982 let curdir = s:NetrwGetCurdir(a:islocal)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7983 let hadtgt = exists("s:netrwmftgt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7984 if !exists("w:netrw_bannercnt")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7985 let w:netrw_bannercnt= b:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7986 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7987
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7988 " set up target
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
7989 if line(".") < w:netrw_bannercnt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7990 " call Decho("set up target: line(.) < w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7991 " if cursor in banner region, use b:netrw_curdir for the target unless its already the target
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7992 if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
7993 " call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7994 unlet s:netrwmftgt s:netrwmftgt_islocal
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7995 if g:netrw_fastbrowse <= 1
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
7996 call s:LocalBrowseRefresh()
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7997 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
7998 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
7999 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8000 call winrestview(svpos)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8001 " call Dret("s:NetrwMarkFileTgt : removed target")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8002 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8003 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8004 let s:netrwmftgt= b:netrw_curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8005 " call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8006 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8007
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8008 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8009 " get word under cursor.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8010 " * If directory, use it for the target.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8011 " * If file, use b:netrw_curdir for the target
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8012 " call Decho("get word under cursor",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8013 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8014 let tgtdir = s:ComposePath(curdir,curword)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8015 if a:islocal && isdirectory(s:NetrwFile(tgtdir))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8016 let s:netrwmftgt = tgtdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8017 " call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8018 elseif !a:islocal && tgtdir =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8019 let s:netrwmftgt = tgtdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8020 " call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8021 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8022 let s:netrwmftgt = curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8023 " call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8024 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8025 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8026 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8027 " simplify the target (eg. /abc/def/../ghi -> /abc/ghi)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8028 let s:netrwmftgt= simplify(s:netrwmftgt)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8029 " call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8030 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8031 if g:netrw_cygwin
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8032 let s:netrwmftgt= substitute(system("cygpath ".s:ShellEscape(s:netrwmftgt)),'\n$','','')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8033 let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8034 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8035 let s:netrwmftgt_islocal= a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8036
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8037 " need to do refresh so that the banner will be updated
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8038 " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8039 if g:netrw_fastbrowse <= 1
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
8040 " call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8041 call s:LocalBrowseRefresh()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8042 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8043 " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8044 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8045 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8046 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8047 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8048 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8049 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8050 call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8051 if !hadtgt
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8052 sil! NetrwKeepj norm! j
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8053 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8054
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8055 " call Decho("getmatches=".string(getmatches()),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8056 " call Decho("s:netrwmarkfilelist=".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : 'n/a'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8057 " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8058 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8059
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8060 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8061 " s:NetrwGetCurdir: gets current directory and sets up b:netrw_curdir if necessary {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8062 fun! s:NetrwGetCurdir(islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8063 " call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8064
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8065 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8066 let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8067 " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8068 elseif !exists("b:netrw_curdir")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8069 let b:netrw_curdir= getcwd()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8070 " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8071 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8072
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
8073 " call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8074 if b:netrw_curdir !~ '\<\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8075 let curdir= b:netrw_curdir
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
8076 " call Decho("g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8077 if g:netrw_keepdir == 0
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8078 call s:NetrwLcd(curdir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8079 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8080 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8081
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8082 " call Dret("s:NetrwGetCurdir <".curdir.">")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8083 return b:netrw_curdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8084 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8085
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8086 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8087 " s:NetrwOpenFile: query user for a filename and open it {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8088 fun! s:NetrwOpenFile(islocal)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8089 " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8090 let ykeep= @@
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8091 call inputsave()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8092 let fname= input("Enter filename: ")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8093 call inputrestore()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8094 if fname !~ '[/\\]'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8095 if exists("b:netrw_curdir")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8096 if exists("g:netrw_quiet")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8097 let netrw_quiet_keep = g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8098 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8099 let g:netrw_quiet = 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8100 " save position for benefit of Rexplore
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8101 let s:rexposn_{bufnr("%")}= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8102 " call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8103 if b:netrw_curdir =~ '/$'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8104 exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8105 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8106 exe "e ".fnameescape(b:netrw_curdir."/".fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8107 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8108 if exists("netrw_quiet_keep")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8109 let g:netrw_quiet= netrw_quiet_keep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8110 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8111 unlet g:netrw_quiet
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8112 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8113 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8114 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8115 exe "NetrwKeepj e ".fnameescape(fname)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8116 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8117 let @@= ykeep
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8118 " call Dret("s:NetrwOpenFile")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8119 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8120
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8121 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8122 " netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8123 " For the mapping to this function be made via
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8124 " netrwPlugin, you'll need to have had
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8125 " g:netrw_usetab set to non-zero.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8126 fun! netrw#Shrink()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8127 " call Dfunc("netrw#Shrink() ft<".&ft."> winwidth=".winwidth(0)." lexbuf#".((exists("t:netrw_lexbufnr"))? t:netrw_lexbufnr : 'n/a'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8128 let curwin = winnr()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8129 let wiwkeep = &wiw
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8130 set wiw=1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8131
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8132 if &ft == "netrw"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8133 if winwidth(0) > g:netrw_wiw
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8134 let t:netrw_winwidth= winwidth(0)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8135 exe "vert resize ".g:netrw_wiw
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8136 wincmd l
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8137 if winnr() == curwin
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8138 wincmd h
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8139 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8140 " call Decho("vert resize 0",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8141 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8142 exe "vert resize ".t:netrw_winwidth
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8143 " call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8144 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8145
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8146 elseif exists("t:netrw_lexbufnr")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8147 exe bufwinnr(t:netrw_lexbufnr)."wincmd w"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8148 if winwidth(bufwinnr(t:netrw_lexbufnr)) > g:netrw_wiw
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8149 let t:netrw_winwidth= winwidth(0)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8150 exe "vert resize ".g:netrw_wiw
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8151 wincmd l
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8152 if winnr() == curwin
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8153 wincmd h
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8154 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8155 " call Decho("vert resize 0",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8156 elseif winwidth(bufwinnr(t:netrw_lexbufnr)) >= 0
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8157 exe "vert resize ".t:netrw_winwidth
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8158 " call Decho("vert resize ".t:netrw_winwidth,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8159 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8160 call netrw#Lexplore(0,0)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8161 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8162
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8163 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8164 call netrw#Lexplore(0,0)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8165 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8166 let wiw= wiwkeep
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8167
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8168 " call Dret("netrw#Shrink")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8169 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8170
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8171 " ---------------------------------------------------------------------
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8172 " s:NetSortSequence: allows user to edit the sorting sequence {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8173 fun! s:NetSortSequence(islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8174 " call Dfunc("NetSortSequence(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8175
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8176 let ykeep= @@
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8177 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8178 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8179 call inputsave()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8180 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8181 call inputrestore()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8182
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8183 " refresh the listing
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8184 let g:netrw_sort_sequence= newsortseq
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8185 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8186 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8187 NetrwKeepj call winrestview(svpos)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8188 let @@= ykeep
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8189
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8190 " call Dret("NetSortSequence")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8191 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8192
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8193 " ---------------------------------------------------------------------
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8194 " s:NetrwUnmarkList: delete local marked file list and remove their contents from the global marked-file list {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8195 " User access provided by the <mF> mapping. (see :help netrw-mF)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8196 " Used by many MarkFile functions.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8197 fun! s:NetrwUnmarkList(curbufnr,curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8198 " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8199
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8200 " remove all files in local marked-file list from global list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8201 if exists("s:netrwmarkfilelist")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8202 for mfile in s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8203 let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8204 let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8205 call remove(s:netrwmarkfilelist,idx) " remove from global list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8206 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8207 if s:netrwmarkfilelist == []
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8208 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8209 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8210
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8211 " getting rid of the local marked-file lists is easy
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8212 unlet s:netrwmarkfilelist_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8213 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8214 if exists("s:netrwmarkfilemtch_{a:curbufnr}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8215 unlet s:netrwmarkfilemtch_{a:curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8216 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8217 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8218 " call Dret("s:NetrwUnmarkList")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8219 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8220
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8221 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8222 " s:NetrwUnmarkAll: remove the global marked file list and all local ones {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8223 fun! s:NetrwUnmarkAll()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8224 " call Dfunc("s:NetrwUnmarkAll()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8225 if exists("s:netrwmarkfilelist")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8226 unlet s:netrwmarkfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8227 endif
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8228 sil call s:NetrwUnmarkAll2()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8229 2match none
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8230 " call Dret("s:NetrwUnmarkAll")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8231 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8232
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8233 " ---------------------------------------------------------------------
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8234 " s:NetrwUnmarkAll2: unmark all files from all buffers {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8235 fun! s:NetrwUnmarkAll2()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8236 " call Dfunc("s:NetrwUnmarkAll2()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8237 redir => netrwmarkfilelist_let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8238 let
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8239 redir END
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8240 let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8241 call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8242 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
8243 for flist in netrwmarkfilelist_list
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8244 let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8245 unlet s:netrwmarkfilelist_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8246 unlet s:netrwmarkfilemtch_{curbufnr}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8247 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8248 " call Dret("s:NetrwUnmarkAll2")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8249 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8251 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8252 " s:NetrwUnMarkFile: called via mu map; unmarks *all* marked files, both global and buffer-local {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8253 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8254 " Marked files are in two types of lists:
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8255 " s:netrwmarkfilelist -- holds complete paths to all marked files
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8256 " s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr())
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8257 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8258 " Marked files suitable for use with 2match are in:
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8259 " s:netrwmarkfilemtch_# -- used with 2match to display marked files
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8260 fun! s:NetrwUnMarkFile(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8261 " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8262 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8263 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8264 let curbufnr = bufnr("%")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8265
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8266 " unmark marked file list
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8267 " (although I expect s:NetrwUpload() to do it, I'm just making sure)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8268 if exists("s:netrwmarkfilelist")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8269 " " call Decho("unlet'ing: s:netrwmarkfilelist",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8270 unlet s:netrwmarkfilelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8271 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8272
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8273 let ibuf= 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8274 while ibuf < bufnr("$")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8275 if exists("s:netrwmarkfilelist_".ibuf)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8276 unlet s:netrwmarkfilelist_{ibuf}
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8277 unlet s:netrwmarkfilemtch_{ibuf}
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8278 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8279 let ibuf = ibuf + 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8280 endwhile
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8281 2match none
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8282
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8283 " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8284 "call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8285 call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8286 " call Dret("s:NetrwUnMarkFile")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8287 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8288
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
8289 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8290 " s:NetrwMenu: generates the menu for gvim and netrw {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8291 fun! s:NetrwMenu(domenu)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8292
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8293 if !exists("g:NetrwMenuPriority")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8294 let g:NetrwMenuPriority= 80
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8295 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8296
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8297 if has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8298 " call Dfunc("NetrwMenu(domenu=".a:domenu.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8299
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8300 if !exists("s:netrw_menu_enabled") && a:domenu
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8301 " call Decho("initialize menu",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8302 let s:netrw_menu_enabled= 1
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8303 exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8304 exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8305 exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8306 exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8307 if g:netrw_dirhistmax > 0
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8308 exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb mb'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8309 exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u u'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8310 exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U U'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8311 exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb qb'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8312 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8313 exe 'sil! menu '.g:NetrwMenuPriority.'.8 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History :echo "(disabled)"'."\<cr>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8314 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8315 exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Horizontal\ Split<tab>o o'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8316 exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Vertical\ Split<tab>v v'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8317 exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.New\ Tab<tab>t t'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8318 exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Preview<tab>p p'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8319 exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'." \<c-h>'"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8320 exe 'sil! menu '.g:NetrwMenuPriority.'.9.6 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S S'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8321 exe 'sil! menu '.g:NetrwMenuPriority.'.9.7 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh gh"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8322 exe 'sil! menu '.g:NetrwMenuPriority.'.9.8 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l> \<c-l>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8323 exe 'sil! menu '.g:NetrwMenuPriority.'.9.9 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8324 exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8325 exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File<tab>% %'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8326 exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr> '."\<cr>"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8327 exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8328 exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8329 exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8330 exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Tab<tab>t t'
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8331 exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8332 exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore '
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8333 exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8334 exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/ :Explore **/'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8335 exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *// :Explore *//'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8336 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **// :Explore **//'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8337 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore :Nexplore<cr>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8338 exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore :Pexplore<cr>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8339 exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8340 exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ File<tab>mf mf'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8341 exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexp<tab>mr mr'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8342 exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Control<tab>a a'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8343 exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Target<tab>mc mc'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8344 exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.Delete<tab>D D'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8345 exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diff<tab>md md'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8346 exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Edit<tab>me me'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8347 exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmd<tab>mx mx'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8348 exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Target<tab>mm mm'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8349 exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.Obtain<tab>O O'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8350 exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Print<tab>mp mp'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8351 exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.Replace<tab>R R'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8352 exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Target<tab>mt mt'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8353 exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.Tag<tab>mT mT'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8354 exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompress<tab>mz mz'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8355 exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8356 exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.thin<tab>i :let w:netrw_liststyle=0<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8357 exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.long<tab>i :let w:netrw_liststyle=1<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8358 exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.wide<tab>i :let w:netrw_liststyle=2<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8359 exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.tree<tab>i :let w:netrw_liststyle=3<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8360 exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.1 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Show\ All<tab>a :let g:netrw_hide=0<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8361 exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.3 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Normal<tab>a :let g:netrw_hide=1<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8362 exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Hidden\ Only<tab>a :let g:netrw_hide=2<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8363 exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order<tab>'."r r"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8364 exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Name<tab>s :let g:netrw_sort_by="name"<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8365 exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Time<tab>s :let g:netrw_sort_by="time"<cr><c-L>'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8366 exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Size<tab>s :let g:netrw_sort_by="size"<cr><c-L>'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8367 exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Exten<tab>s :let g:netrw_sort_by="exten"<cr><c-L>'
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8368 exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8369 exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8370 let s:netrw_menucnt= 28
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8371 call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8372 call s:NetrwTgtMenu() " let bookmarks and history be easy targets
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8373
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8374 elseif !a:domenu
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8375 let s:netrwcnt = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8376 let curwin = winnr()
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
8377 windo if getline(2) =~# "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8378 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8379
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8380 if s:netrwcnt <= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8381 " call Decho("clear menus",'~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8382 exe 'sil! unmenu '.g:NetrwTopLvlMenu
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8383 " call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*','~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8384 sil! unlet s:netrw_menu_enabled
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8385 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8386 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8387 " call Dret("NetrwMenu")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8388 return
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8389 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8390
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8391 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8392
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8393 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8394 " s:NetrwObtain: obtain file under cursor or from markfile list {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8395 " Used by the O maps (as <SID>NetrwObtain())
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8396 fun! s:NetrwObtain(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8397 " call Dfunc("NetrwObtain(islocal=".a:islocal.")")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8398
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8399 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8400 if exists("s:netrwmarkfilelist_{bufnr('%')}")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8401 let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\{3,}://'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8402 call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')})
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8403 call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8404 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8405 call netrw#Obtain(a:islocal,s:NetrwGetWord())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8406 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8407 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8408
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8409 " call Dret("NetrwObtain")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8410 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8411
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8412 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8413 " s:NetrwPrevWinOpen: open file/directory in previous window. {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8414 " If there's only one window, then the window will first be split.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8415 " Returns:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8416 " choice = 0 : didn't have to choose
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8417 " choice = 1 : saved modified file in window first
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8418 " choice = 2 : didn't save modified file, opened window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8419 " choice = 3 : cancel open
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8420 fun! s:NetrwPrevWinOpen(islocal)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8421 " call Dfunc("s:NetrwPrevWinOpen(islocal=".a:islocal.")")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8422
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8423 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8424 " grab a copy of the b:netrw_curdir to pass it along to newly split windows
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8425 let curdir = b:netrw_curdir
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8426
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8427 " get last window number and the word currently under the cursor
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8428 let origwin = winnr()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8429 let lastwinnr = winnr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8430 let curword = s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8431 let choice = 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8432 let s:treedir = s:NetrwTreeDir(a:islocal)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8433 let curdir = s:treedir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8434 " call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8435
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8436 let didsplit = 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8437 if lastwinnr == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8438 " if only one window, open a new one first
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8439 " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8440 " g:netrw_preview=0: preview window shown in a horizontally split window
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8441 " g:netrw_preview=1: preview window shown in a vertically split window
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8442 if g:netrw_preview
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8443 " vertically split preview window
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8444 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8445 " call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
8446 exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8447 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8448 " horizontally split preview window
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8449 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8450 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
8451 exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8452 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8453 let didsplit = 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8454 " call Decho("did split",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8455
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8456 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8457 NetrwKeepj call s:SaveBufVars()
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8458 let eikeep= &ei
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8459 setl ei=all
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8460 wincmd p
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8461 " call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8462
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8463 " prevwinnr: the window number of the "prev" window
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8464 " prevbufnr: the buffer number of the buffer in the "prev" window
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8465 " bnrcnt : the qty of windows open on the "prev" buffer
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8466 let prevwinnr = winnr()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8467 let prevbufnr = bufnr("%")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8468 let prevbufname = bufname("%")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8469 let prevmod = &mod
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8470 let bnrcnt = 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8471 NetrwKeepj call s:RestoreBufVars()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8472 " call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr,'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8473
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8474 " if the previous window's buffer has been changed (ie. its modified flag is set),
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8475 " and it doesn't appear in any other extant window, then ask the
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8476 " user if s/he wants to abandon modifications therein.
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8477 if prevmod
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8478 " call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr(),'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8479 windo if winbufnr(0) == prevbufnr | let bnrcnt=bnrcnt+1 | endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8480 " call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr,'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8481 exe prevwinnr."wincmd w"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8482
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8483 if bnrcnt == 1 && &hidden == 0
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8484 " only one copy of the modified buffer in a window, and
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8485 " hidden not set, so overwriting will lose the modified file. Ask first...
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8486 let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8487 " call Decho("prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8488 let &ei= eikeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8489
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8490 if choice == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8491 " Yes -- write file & then browse
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8492 let v:errmsg= ""
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8493 sil w
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8494 if v:errmsg != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8495 call netrw#ErrorMsg(s:ERROR,"unable to write <".(exists("prevbufname")? prevbufname : 'n/a').">!",30)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8496 exe origwin."wincmd w"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8497 let &ei = eikeep
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8498 let @@ = ykeep
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8499 " call Dret("s:NetrwPrevWinOpen ".choice." : unable to write <".prevbufname.">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8500 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8501 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8502
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8503 elseif choice == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8504 " No -- don't worry about changed file, just browse anyway
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8505 " call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8506 echomsg "**note** changes to ".prevbufname." abandoned"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8507
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8508 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8509 " Cancel -- don't do this
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8510 " call Decho("cancel, don't browse, switch to win#".origwin,'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8511 exe origwin."wincmd w"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8512 let &ei= eikeep
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8513 let @@ = ykeep
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8514 " call Dret("s:NetrwPrevWinOpen ".choice." : cancelled")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8515 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8516 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8517 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8518 endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8519 let &ei= eikeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8520 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8521
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8522 " restore b:netrw_curdir (window split/enew may have lost it)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8523 let b:netrw_curdir= curdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8524 if a:islocal < 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8525 if a:islocal
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8526 call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8527 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8528 call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,curword))
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8529 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8530 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8531 let @@= ykeep
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
8532 " call Dret("s:NetrwPrevWinOpen ".choice)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8533 return choice
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8534 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8535
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8536 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8537 " s:NetrwUpload: load fname to tgt (used by NetrwMarkFileCopy()) {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8538 " Always assumed to be local -> remote
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8539 " call s:NetrwUpload(filename, target)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8540 " call s:NetrwUpload(filename, target, fromdirectory)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8541 fun! s:NetrwUpload(fname,tgt,...)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8542 " 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
8543
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8544 if a:tgt =~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8545 let tgtdir= substitute(a:tgt,'^\a\{3,}://[^/]\+/\(.\{-}\)$','\1','')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8546 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8547 let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8548 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8549 " call Decho("tgtdir<".tgtdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8550
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8551 if a:0 > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8552 let fromdir= a:1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8553 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8554 let fromdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8555 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8556 " call Decho("fromdir<".fromdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8557
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8558 if type(a:fname) == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8559 " handle uploading a single file using NetWrite
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8560 " call Decho("handle uploading a single file via NetWrite",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8561 1split
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8562 " call Decho("exe e ".fnameescape(s:NetrwFile(a:fname)),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8563 exe "NetrwKeepj e ".fnameescape(s:NetrwFile(a:fname))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8564 " call Decho("now locally editing<".expand("%").">, has ".line("$")." lines",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8565 if a:tgt =~ '/$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8566 let wfname= substitute(a:fname,'^.*/','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8567 " call Decho("exe w! ".fnameescape(wfname),'~'.expand("<slnum>"))
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8568 exe "w! ".fnameescape(a:tgt.wfname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8569 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8570 " call Decho("writing local->remote: exe w ".fnameescape(a:tgt),'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
8571 exe "w ".fnameescape(a:tgt)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8572 " call Decho("done writing local->remote",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8573 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8574 q!
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8575
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8576 elseif type(a:fname) == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8577 " handle uploading a list of files via scp
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8578 " call Decho("handle uploading a list of files via scp",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8579 let curdir= getcwd()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8580 if a:tgt =~ '^scp:'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8581 if s:NetrwLcd(fromdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8582 " call Dret("s:NetrwUpload : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8583 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8584 endif
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
8585 let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')})
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8586 let args = join(map(filelist,"s:ShellEscape(v:val, 1)"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8587 if exists("g:netrw_port") && g:netrw_port != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8588 let useport= " ".g:netrw_scpport." ".g:netrw_port
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8589 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8590 let useport= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8591 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8592 let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8593 let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8594 call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8595 if s:NetrwLcd(curdir)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8596 " call Dret("s:NetrwUpload : lcd failure")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8597 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8598 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8599
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8600 elseif a:tgt =~ '^ftp:'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8601 call s:NetrwMethod(a:tgt)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8602
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8603 if b:netrw_method == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8604 " handle uploading a list of files via ftp+.netrc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8605 let netrw_fname = b:netrw_fname
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8606 sil NetrwKeepj new
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8607 " call Decho("filter input window#".winnr(),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8608
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8609 NetrwKeepj put =g:netrw_ftpmode
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8610 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8611
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8612 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8613 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8614 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8615 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8616
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8617 NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8618 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8619
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8620 if tgtdir == ""
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8621 let tgtdir= '/'
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8622 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8623 NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8624 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8625
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8626 for fname in a:fname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8627 NetrwKeepj call setline(line("$")+1,'put "'.s:NetrwFile(fname).'"')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8628 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8629 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8630
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8631 if exists("g:netrw_port") && g:netrw_port != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8632 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8633 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8634 " call Decho("filter input window#".winnr(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8635 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8636 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8637 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8638 sil NetrwKeepj g/Local directory now/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8639 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8640 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8641 call netrw#ErrorMsg(s:ERROR,getline(1),14)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8642 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8643 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8644 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8645
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8646 elseif b:netrw_method == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8647 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8648 let netrw_fname= b:netrw_fname
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8649 NetrwKeepj call s:SaveBufVars()|sil NetrwKeepj new|NetrwKeepj call s:RestoreBufVars()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8650 let tmpbufnr= bufnr("%")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8651 setl ff=unix
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8652
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8653 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8654 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8655 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8656 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8657 NetrwKeepj put ='open '.g:netrw_machine
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8658 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8659 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8660
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8661 if exists("g:netrw_uid") && g:netrw_uid != ""
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8662 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8663 NetrwKeepj put =g:netrw_uid
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8664 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8665 if exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8666 NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"')
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8667 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8668 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8669 elseif exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8670 NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8671 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
8672 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8673 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8674
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8675 NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8676 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8677
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8678 if exists("b:netrw_fname") && b:netrw_fname != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8679 NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8680 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8681 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8682
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8683 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8684 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8685 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8686 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8687
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8688 for fname in a:fname
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8689 NetrwKeepj call setline(line("$")+1,'put "'.fname.'"')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8690 " call Decho("filter input: ".getline('$'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8691 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8692
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8693 " perform ftp:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8694 " -i : turns off interactive prompting from ftp
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8695 " -n unix : DON'T use <.netrc>, even though it exists
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8696 " -n win32: quit being obnoxious about password
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8697 NetrwKeepj norm! 1Gdd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8698 call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8699 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8700 sil NetrwKeepj g/Local directory now/d
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8701 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8702 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8703 let debugkeep= &debug
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8704 setl debug=msg
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8705 call netrw#ErrorMsg(s:ERROR,getline(1),15)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8706 let &debug = debugkeep
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8707 let mod = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8708 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8709 bw!|q
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8710 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8711 elseif !exists("b:netrw_method") || b:netrw_method < 0
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8712 " call Dret("s:#NetrwUpload : unsupported method")
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8713 return
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8714 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8715 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8716 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
8717 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8718 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8719
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8720 " call Dret("s:NetrwUpload")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8721 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8722
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8723 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8724 " s:NetrwPreview: supports netrw's "p" map {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8725 fun! s:NetrwPreview(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8726 " call Dfunc("NetrwPreview(path<".a:path.">)")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8727 " call Decho("g:netrw_alto =".(exists("g:netrw_alto")? g:netrw_alto : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8728 " call Decho("g:netrw_preview=".(exists("g:netrw_preview")? g:netrw_preview : 'n/a'),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8729 let ykeep= @@
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8730 NetrwKeepj call s:NetrwOptionsSave("s:")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8731 if a:path !~ '^\*\{1,2}/' && a:path !~ '^\a\{3,}://'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8732 NetrwKeepj call s:NetrwOptionsSafe(1)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8733 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8734 NetrwKeepj call s:NetrwOptionsSafe(0)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8735 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8736 if has("quickfix")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8737 " call Decho("has quickfix",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8738 if !isdirectory(s:NetrwFile(a:path))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8739 " call Decho("good; not previewing a directory",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8740 if g:netrw_preview
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8741 " vertical split
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
8742 let pvhkeep = &pvh
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
8743 let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
8744 let &pvh = winwidth(0) - winsz
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8745 " call Decho("g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8746 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8747 " horizontal split
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8748 let pvhkeep = &pvh
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8749 let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8750 let &pvh = winheight(0) - winsz
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8751 " call Decho("!g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8752 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8753 " g:netrw_preview g:netrw_alto
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8754 " 1 : vert 1: top -- preview window is vertically split off and on the left
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8755 " 1 : vert 0: bot -- preview window is vertically split off and on the right
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8756 " 0 : 1: top -- preview window is horizontally split off and on the top
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8757 " 0 : 0: bot -- preview window is horizontally split off and on the bottom
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8758 "
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8759 " Note that the file being previewed is already known to not be a directory, hence we can avoid doing a LocalBrowse() check via
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8760 " the BufEnter event set up in netrwPlugin.vim
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8761 " call Decho("exe ".(g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8762 let eikeep = &ei
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8763 set ei=BufEnter
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8764 exe (g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8765 let &ei= eikeep
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8766 " call Decho("winnr($)=".winnr("$"),'~'.expand("<slnum>"))
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8767 if exists("pvhkeep")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8768 let &pvh= pvhkeep
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
8769 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8770 elseif !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8771 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8772 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8773 elseif !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8774 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8775 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8776 NetrwKeepj call s:NetrwOptionsRestore("s:")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8777 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8778 " call Dret("NetrwPreview")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8779 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8780
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8781 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8782 " s:NetrwRefresh: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8783 fun! s:NetrwRefresh(islocal,dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8784 " call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") g:netrw_hide=".g:netrw_hide." g:netrw_sort_direction=".g:netrw_sort_direction)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8785 " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first.
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8786 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8787 " call Decho("setl ma noro",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8788 " call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8789 let ykeep = @@
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8790 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8791 if !exists("w:netrw_treetop")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8792 if exists("b:netrw_curdir")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8793 let w:netrw_treetop= b:netrw_curdir
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8794 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8795 let w:netrw_treetop= getcwd()
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8796 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8797 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8798 NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8799 endif
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8800
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8801 " save the cursor position before refresh.
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8802 let screenposn = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8803 " call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8804
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8805 " call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8806 " call Decho("clearing buffer prior to refresh",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8807 sil! NetrwKeepj %d _
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8808 if a:islocal
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8809 NetrwKeepj call netrw#LocalBrowseCheck(a:dirname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8810 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8811 NetrwKeepj call s:NetrwBrowse(a:islocal,a:dirname)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
8812 endif
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8813
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8814 " restore position
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8815 " call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8816 NetrwKeepj call winrestview(screenposn)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8817
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8818 " restore file marks
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8819 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8820 if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8821 " " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8822 exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8823 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8824 " " call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8825 2match none
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8826 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
8827 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8828
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8829 " restore
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8830 let @@= ykeep
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8831 " call Dret("s:NetrwRefresh")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8832 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8833
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8834 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8835 " s:NetrwRefreshDir: refreshes a directory by name {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8836 " Called by NetrwMarkFileCopy()
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8837 " Interfaces to s:NetrwRefresh() and s:LocalBrowseRefresh()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8838 fun! s:NetrwRefreshDir(islocal,dirname)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8839 " call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8840 if g:netrw_fastbrowse == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8841 " slowest mode (keep buffers refreshed, local or remote)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8842 " call Decho("slowest mode: keep buffers refreshed, local or remote",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8843 let tgtwin= bufwinnr(a:dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8844 " call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8845
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8846 if tgtwin > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8847 " tgtwin is being displayed, so refresh it
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8848 let curwin= winnr()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8849 " call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8850 exe tgtwin."wincmd w"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8851 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8852 exe curwin."wincmd w"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8853
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8854 elseif bufnr(a:dirname) > 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8855 let bn= bufnr(a:dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8856 " call Decho("bd bufnr(".a:dirname.")=".bn,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8857 exe "sil keepj bd ".bn
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8858 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8859
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8860 elseif g:netrw_fastbrowse <= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8861 " call Decho("medium-speed mode: refresh local buffers only",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8862 NetrwKeepj call s:LocalBrowseRefresh()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8863 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8864 " call Dret("s:NetrwRefreshDir")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8865 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8866
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8867 " ---------------------------------------------------------------------
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8868 " s:NetrwSetChgwin: set g:netrw_chgwin; a <cr> will use the specified
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8869 " window number to do its editing in.
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8870 " Supports [count]C where the count, if present, is used to specify
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8871 " a window to use for editing via the <cr> mapping.
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8872 fun! s:NetrwSetChgwin(...)
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8873 " call Dfunc("s:NetrwSetChgwin() v:count=".v:count)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8874 if a:0 > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8875 " call Decho("a:1<".a:1.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8876 if a:1 == "" " :NetrwC win#
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8877 let g:netrw_chgwin= winnr()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8878 else " :NetrwC
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8879 let g:netrw_chgwin= a:1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8880 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8881 elseif v:count > 0 " [count]C
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8882 let g:netrw_chgwin= v:count
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8883 else " C
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8884 let g:netrw_chgwin= winnr()
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8885 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8886 echo "editing window now set to window#".g:netrw_chgwin
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8887 " call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin)
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8888 endfun
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8889
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
8890 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8891 " 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
8892 " What this function does is to compute a priority for the patterns
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8893 " in the g:netrw_sort_sequence. It applies a substitute to any
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8894 " "files" that satisfy each pattern, putting the priority / in
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8895 " front. An "*" pattern handles the default priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8896 fun! s:NetrwSetSort()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8897 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8898 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8899 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8900 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8901 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8902 let seqlist = g:netrw_sort_sequence
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8903 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8904 " sanity check -- insure that * appears somewhere
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8905 if seqlist == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8906 let seqlist= '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8907 elseif seqlist !~ '\*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8908 let seqlist= seqlist.',*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8909 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8910 let priority = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8911 while seqlist != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8912 if seqlist =~ ','
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8913 let seq = substitute(seqlist,',.*$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8914 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8915 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8916 let seq = seqlist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8917 let seqlist = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8918 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8919 if priority < 10
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8920 let spriority= "00".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8921 elseif priority < 100
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8922 let spriority= "0".priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8923 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8924 let spriority= priority.g:netrw_sepchr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8925 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
8926 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8927
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8928 " sanity check
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8929 if w:netrw_bannercnt > line("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8930 " apparently no files were left after a Hiding pattern was used
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8931 " call Dret("SetSort : no files left after hiding")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8932 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8933 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8934 if seq == '*'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8935 let starpriority= spriority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8936 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8937 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/'
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
8938 call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8939 " sometimes multiple sorting patterns will match the same file or directory.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8940 " The following substitute is intended to remove the excess matches.
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8941 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8942 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8943 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8944 let priority = priority + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8945 endwhile
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8946 if exists("starpriority")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8947 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8948 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8949 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8950
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8951 " Following line associated with priority -- items that satisfy a priority
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8952 " pattern get prefixed by ###/ which permits easy sorting by priority.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8953 " Sometimes files can satisfy multiple priority patterns -- only the latest
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8954 " priority pattern needs to be retained. So, at this point, these excess
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8955 " priority prefixes need to be removed, but not directories that happen to
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8956 " be just digits themselves.
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8957 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
8958 NetrwKeepj call histdel("/",-1)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
8959 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8960
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8961 " call Dret("SetSort")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8962 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
8963
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8964 " ---------------------------------------------------------------------
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8965 " s:NetrwSetTgt: sets the target to the specified choice index {{{2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8966 " Implements [count]Tb (bookhist<b>)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8967 " [count]Th (bookhist<h>)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8968 " See :help netrw-qb for how to make the choice.
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8969 fun! s:NetrwSetTgt(islocal,bookhist,choice)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8970 " call Dfunc("s:NetrwSetTgt(islocal=".a:islocal." bookhist<".a:bookhist."> choice#".a:choice.")")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8971
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8972 if a:bookhist == 'b'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8973 " supports choosing a bookmark as a target using a qb-generated list
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8974 let choice= a:choice - 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8975 if exists("g:netrw_bookmarklist[".choice."]")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8976 call netrw#MakeTgt(g:netrw_bookmarklist[choice])
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8977 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8978 echomsg "Sorry, bookmark#".a:choice." doesn't exist!"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8979 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8980
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8981 elseif a:bookhist == 'h'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8982 " supports choosing a history stack entry as a target using a qb-generated list
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8983 let choice= (a:choice % g:netrw_dirhistmax) + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8984 if exists("g:netrw_dirhist_".choice)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8985 let histentry = g:netrw_dirhist_{choice}
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
8986 call netrw#MakeTgt(histentry)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8987 else
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8988 echomsg "Sorry, history#".a:choice." not available!"
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8989 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8990 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8991
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8992 " refresh the display
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8993 if !exists("b:netrw_curdir")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8994 let b:netrw_curdir= getcwd()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8995 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8996 call s:NetrwRefresh(a:islocal,b:netrw_curdir)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
8997
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8998 " call Dret("s:NetrwSetTgt")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
8999 endfun
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9000
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9001 " =====================================================================
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9002 " s:NetrwSortStyle: change sorting style (name - time - size - exten) and refresh display {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9003 fun! s:NetrwSortStyle(islocal)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9004 " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9005 NetrwKeepj call s:NetrwSaveWordPosn()
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9006 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9007 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9008
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9009 let g:netrw_sort_by= (g:netrw_sort_by =~# '^n')? 'time' : (g:netrw_sort_by =~# '^t')? 'size' : (g:netrw_sort_by =~# '^siz')? 'exten' : 'name'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9010 NetrwKeepj norm! 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9011 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9012 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9013 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9014
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9015 " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9016 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9017
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9018 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9019 " s:NetrwSplit: mode {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9020 " =0 : net and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9021 " =1 : net and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9022 " =2 : net and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9023 " =3 : local and o
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9024 " =4 : local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9025 " =5 : local and v
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9026 fun! s:NetrwSplit(mode)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9027 " 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
9028
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
9029 let ykeep= @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9030 call s:SaveWinVars()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9031
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9032 if a:mode == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9033 " remote and o
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
9034 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9035 if winsz == 0|let winsz= ""|endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9036 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>"))
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
9037 exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9038 let s:didsplit= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9039 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9040 NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9041 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9042
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9043 elseif a:mode == 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9044 " remote and t
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9045 let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord())
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9046 " call Decho("tabnew",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9047 tabnew
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9048 let s:didsplit= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9049 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9050 NetrwKeepj call s:NetrwBrowse(0,newdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9051 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9052
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9053 elseif a:mode == 2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9054 " remote and v
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
9055 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9056 if winsz == 0|let winsz= ""|endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9057 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>"))
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
9058 exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9059 let s:didsplit= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9060 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9061 NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9062 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9063
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9064 elseif a:mode == 3
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9065 " local and o
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
9066 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9067 if winsz == 0|let winsz= ""|endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9068 " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("<slnum>"))
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
9069 exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9070 let s:didsplit= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9071 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9072 NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9073 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9074
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9075 elseif a:mode == 4
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9076 " local and t
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9077 let cursorword = s:NetrwGetWord()
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9078 let eikeep = &ei
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9079 let netrw_winnr = winnr()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9080 let netrw_line = line(".")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9081 let netrw_col = virtcol(".")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9082 NetrwKeepj norm! H0
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9083 let netrw_hline = line(".")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9084 setl ei=all
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9085 exe "NetrwKeepj norm! ".netrw_hline."G0z\<CR>"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9086 exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\<bar>"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9087 let &ei = eikeep
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9088 let netrw_curdir = s:NetrwTreeDir(0)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9089 " call Decho("tabnew",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9090 tabnew
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9091 let b:netrw_curdir = netrw_curdir
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9092 let s:didsplit = 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9093 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9094 NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9095 if &ft == "netrw"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9096 setl ei=all
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9097 exe "NetrwKeepj norm! ".netrw_hline."G0z\<CR>"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9098 exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\<bar>"
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9099 let &ei= eikeep
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9100 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9101 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9102
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9103 elseif a:mode == 5
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9104 " local and v
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
9105 let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9106 if winsz == 0|let winsz= ""|endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9107 " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("<slnum>"))
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
9108 exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9109 let s:didsplit= 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9110 NetrwKeepj call s:RestoreWinVars()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9111 NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord()))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9112 unlet s:didsplit
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9113
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9114 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9115 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9116 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9117
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
9118 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9119 " call Dret("s:NetrwSplit")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9120 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9121
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9122 " ---------------------------------------------------------------------
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9123 " s:NetrwTgtMenu: {{{2
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9124 fun! s:NetrwTgtMenu()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9125 if !exists("s:netrw_menucnt")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9126 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9127 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9128 " call Dfunc("s:NetrwTgtMenu()")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9129
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9130 " the following test assures that gvim is running, has menus available, and has menus enabled.
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9131 if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9132 if exists("g:NetrwTopLvlMenu")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9133 " call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9134 exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets'
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9135 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9136 if !exists("s:netrw_initbookhist")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9137 call s:NetrwBookHistRead()
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9138 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9139
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9140 " try to cull duplicate entries
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9141 let tgtdict={}
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9142
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9143 " target bookmarked places
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9144 if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9145 " call Decho("installing bookmarks as easy targets",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9146 let cnt= 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9147 for bmd in g:netrw_bookmarklist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9148 if has_key(tgtdict,bmd)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9149 let cnt= cnt + 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9150 continue
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9151 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9152 let tgtdict[bmd]= cnt
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9153 let ebmd= escape(bmd,g:netrw_menu_escape)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9154 " show bookmarks for goto menu
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9155 " call Decho("menu: Targets: ".bmd,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9156 exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#MakeTgt('".bmd."')\<cr>"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9157 let cnt= cnt + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9158 endfor
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9159 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9160
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9161 " target directory browsing history
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9162 if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9163 " call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("<slnum>"))
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9164 let histcnt = 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9165 while histcnt <= g:netrw_dirhistmax
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9166 let priority = g:netrw_dirhistcnt + histcnt
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9167 if exists("g:netrw_dirhist_{histcnt}")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9168 let histentry = g:netrw_dirhist_{histcnt}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9169 if has_key(tgtdict,histentry)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9170 let histcnt = histcnt + 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9171 continue
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9172 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9173 let tgtdict[histentry] = histcnt
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9174 let ehistentry = escape(histentry,g:netrw_menu_escape)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9175 " call Decho("menu: Targets: ".histentry,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9176 exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#MakeTgt('".histentry."')\<cr>"
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9177 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9178 let histcnt = histcnt + 1
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9179 endwhile
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9180 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9181 endif
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9182 " call Dret("s:NetrwTgtMenu")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9183 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9184
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9185 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9186 " s:NetrwTreeDir: determine tree directory given current cursor position {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9187 " (full path directory with trailing slash returned)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9188 fun! s:NetrwTreeDir(islocal)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9189 " call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9190 " call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9191 " call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9192 " call Decho("w:netrw_treetop =".(exists("w:netrw_treetop")? w:netrw_treetop : 'n/a'),'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9193
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9194 if exists("s:treedir")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9195 " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9196 let treedir= s:treedir
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9197 unlet s:treedir
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9198 " call Dret("s:NetrwTreeDir ".treedir)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9199 return treedir
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9200 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9201
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9202 if !exists("b:netrw_curdir") || b:netrw_curdir == ""
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9203 let b:netrw_curdir= getcwd()
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9204 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9205 let treedir = b:netrw_curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9206 " call Decho("set initial treedir<".treedir.">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9207
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9208 let s:treecurpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9209 " call Decho("saving posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9210
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9211 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9212 " call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9213 " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9214
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9215 " extract tree directory if on a line specifying a subdirectory (ie. ends with "/")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9216 let curline= substitute(getline('.'),"\t -->.*$",'','')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9217 if curline =~ '/$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9218 " call Decho("extract tree subdirectory from current line",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9219 let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9220 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9221 elseif curline =~ '@$'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9222 " call Decho("handle symbolic link from current line",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9223 let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9224 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9225 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9226 " call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9227 let treedir= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9228 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9229
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9230 " detect user attempting to close treeroot
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9231 " call Decho("check if user is attempting to close treeroot",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9232 " call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9233 " call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~# '^'.s:treedepthstring)? '=~#' : '!~').' ^'.s:treedepthstring,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9234 if curline !~ '^'.s:treedepthstring && getline('.') != '..'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9235 " call Decho(".user may have attempted to close treeroot",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9236 " now force a refresh
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9237 " call Decho(".force refresh: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9238 sil! NetrwKeepj %d _
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9239 " call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9240 return b:netrw_curdir
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9241 " else " Decho
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9242 " call Decho(".user not attempting to close treeroot",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9243 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9244
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9245 " call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9246 let potentialdir= s:NetrwFile(substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)@$','\1',''))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9247 " call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir),'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9248
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9249 " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9250 " if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9251 " let newdir = w:netrw_treetop.'/'.potentialdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9252 " " call Decho("apply NetrwTreePath to newdir<".newdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9253 " let treedir = s:NetrwTreePath(newdir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9254 " let w:netrw_treetop = newdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9255 " " call Decho("newdir <".newdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9256 " else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9257 " call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9258 let treedir = s:NetrwTreePath(w:netrw_treetop)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9259 " endif
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9260 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9261
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9262 " sanity maintenance: keep those //s away...
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9263 let treedir= substitute(treedir,'//$','/','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9264 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9265
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9266 " call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9267 return treedir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9268 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9269
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9270 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9271 " s:NetrwTreeDisplay: recursive tree display {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9272 fun! s:NetrwTreeDisplay(dir,depth)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9273 " call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9274
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9275 " insure that there are no folds
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9276 setl nofen
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9277
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9278 " install ../ and shortdir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9279 if a:depth == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9280 call setline(line("$")+1,'../')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9281 " call Decho("setline#".line("$")." ../ (depth is zero)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9282 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9283 if a:dir =~ '^\a\{3,}://'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9284 if a:dir == w:netrw_treetop
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9285 let shortdir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9286 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9287 let shortdir= substitute(a:dir,'^.*/\([^/]\+\)/$','\1/','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9288 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9289 call setline(line("$")+1,a:depth.shortdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9290 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9291 let shortdir= substitute(a:dir,'^.*/','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9292 call setline(line("$")+1,a:depth.shortdir.'/')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9293 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9294 " call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9295
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9296 " append a / to dir if its missing one
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9297 let dir= a:dir
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9298
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9299 " display subtrees (if any)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9300 let depth= s:treedepthstring.a:depth
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9301 " call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9302
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9303 " implement g:netrw_hide for tree listings (uses g:netrw_list_hide)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9304 if g:netrw_hide == 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9305 " hide given patterns
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9306 let listhide= split(g:netrw_list_hide,',')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9307 " call Decho("listhide=".string(listhide))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9308 for pat in listhide
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9309 call filter(w:netrw_treedict[dir],'v:val !~ "'.pat.'"')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9310 endfor
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9311
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9312 elseif g:netrw_hide == 2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9313 " show given patterns (only)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9314 let listhide= split(g:netrw_list_hide,',')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9315 " call Decho("listhide=".string(listhide))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9316 let entries=[]
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9317 for entry in w:netrw_treedict[dir]
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9318 for pat in listhide
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9319 if entry =~ pat
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9320 call add(entries,entry)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9321 break
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9322 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9323 endfor
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9324 endfor
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9325 let w:netrw_treedict[dir]= entries
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9326 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9327 if depth != ""
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9328 " always remove "." and ".." entries when there's depth
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9329 call filter(w:netrw_treedict[dir],'v:val !~ "\\.\\.$"')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9330 call filter(w:netrw_treedict[dir],'v:val !~ "\\.$"')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9331 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9332
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9333 " call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9334 for entry in w:netrw_treedict[dir]
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9335 if dir =~ '/$'
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9336 let direntry= substitute(dir.entry,'[@/]$','','e')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9337 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9338 let direntry= substitute(dir.'/'.entry,'[@/]$','','e')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9339 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9340 " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9341 if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9342 " call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9343 NetrwKeepj call s:NetrwTreeDisplay(direntry,depth)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9344 elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9345 " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9346 NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9347 elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9348 " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9349 NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9350 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9351 " call Decho("<".entry."> is not a key in treedict (no subtree)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9352 sil! NetrwKeepj call setline(line("$")+1,depth.entry)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9353 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9354 endfor
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9355 " call Decho("displaying: ".string(getline(w:netrw_bannercnt,'$')))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9356
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9357 " call Dret("NetrwTreeDisplay")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9358 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9359
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9360 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9361 " s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9362 fun! s:NetrwRefreshTreeDict(dir)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9363 " call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9364 if !exists("w:netrw_treedict")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9365 " call Dret("s:NetrwRefreshTreeDict : w:netrw_treedict doesn't exist")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9366 return
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9367 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9368
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9369 for entry in w:netrw_treedict[a:dir]
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9370 let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9371 " call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9372
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9373 if entry =~ '/$' && has_key(w:netrw_treedict,direntry)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9374 " call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9375 NetrwKeepj call s:NetrwRefreshTreeDict(direntry)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9376 let liststar = s:NetrwGlob(direntry,'*',1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9377 let listdotstar = s:NetrwGlob(direntry,'.*',1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9378 let w:netrw_treedict[direntry] = liststar + listdotstar
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9379 " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9380
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9381 elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9382 " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9383 NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9384 let liststar = s:NetrwGlob(direntry.'/','*',1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9385 let listdotstar= s:NetrwGlob(direntry.'/','.*',1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9386 let w:netrw_treedict[direntry]= liststar + listdotstar
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9387 " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9388
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9389 elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9390 " call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9391 NetrwKeepj call s:NetrwRefreshTreeDict(direntry.'/')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9392 let liststar = s:NetrwGlob(direntry.'/','*',1)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9393 let listdotstar= s:NetrwGlob(direntry.'/','.*',1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9394 " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9395
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9396 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9397 " call Decho('not updating w:netrw_treedict['.string(direntry).'] with entry<'.string(entry).'> (no subtree)','~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9398 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9399 endfor
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9400 " call Dret("s:NetrwRefreshTreeDict")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9401 endfun
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9402
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9403 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9404 " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9405 " Called by s:PerformListing()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9406 fun! s:NetrwTreeListing(dirname)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9407 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9408 " call Dfunc("NetrwTreeListing() bufname<".expand("%").">")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9409 " call Decho("curdir<".a:dirname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9410 " call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9411 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9412
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9413 " update the treetop
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9414 " call Decho("update the treetop",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9415 if !exists("w:netrw_treetop")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9416 let w:netrw_treetop= a:dirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9417 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9418 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
9419 let w:netrw_treetop= a:dirname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9420 " call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9421 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9422
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9423 if !exists("w:netrw_treedict")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9424 " insure that we have a treedict, albeit empty
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9425 " call Decho("initializing w:netrw_treedict to empty",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9426 let w:netrw_treedict= {}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9427 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9428
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9429 " update the dictionary for the current directory
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9430 " call Decho("updating: w:netrw_treedict[".a:dirname.'] -> [directory listing]','~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9431 " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9432 exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d _'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9433 let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9434 " call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9435 exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9436
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9437 " if past banner, record word
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9438 if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9439 let fname= expand("<cword>")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9440 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9441 let fname= ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9442 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9443 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9444 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9445
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9446 " display from treetop on down
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9447 NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9448 " call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9449
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9450 " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9451 while getline(1) =~ '^\s*$' && byte2line(1) > 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9452 " call Decho("deleting blank line",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9453 1d
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9454 endwhile
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9455
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9456 exe "setl ".g:netrw_bufsettings
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9457
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9458 " call Dret("NetrwTreeListing : bufname<".expand("%").">")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
9459 return
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9460 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9461 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9462
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9463 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9464 " s:NetrwTreePath: returns path to current file/directory in tree listing {{{2
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9465 " Normally, treetop is w:netrw_treetop, but a
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9466 " user of the function ( netrw#SetTreetop() )
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9467 " wipes that out prior to calling this function
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9468 fun! s:NetrwTreePath(treetop)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9469 " call Dfunc("s:NetrwTreePath(treetop<".a:treetop.">) line#".line(".")."<".getline(".").">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9470 if line(".") < w:netrw_bannercnt + 2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9471 let treedir= a:treetop
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9472 if treedir !~ '/$'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9473 let treedir= treedir.'/'
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9474 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9475 " call Dret("s:NetrwTreePath ".treedir." : line#".line(".")." ≤ ".(w:netrw_bannercnt+2))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9476 return treedir
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9477 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9478
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9479 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9480 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9481 let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9482 " call Decho("depth<".depth."> 1st subst",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9483 let depth = substitute(depth,'^'.s:treedepthstring,'','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9484 " call Decho("depth<".depth."> 2nd subst (first depth removed)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9485 let curline= getline('.')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9486 " call Decho("curline<".curline.'>','~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9487 if curline =~ '/$'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9488 " call Decho("extract tree directory from current line",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9489 let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9490 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9491 elseif curline =~ '@\s\+-->'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9492 " call Decho("extract tree directory using symbolic link",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9493 let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9494 let treedir= substitute(treedir,'@\s\+-->.*$','','e')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9495 " call Decho("treedir<".treedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9496 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9497 " call Decho("do not extract tree directory from current line and set treedir to empty",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9498 let treedir= ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9499 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9500 " construct treedir by searching backwards at correct depth
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9501 " call Decho("construct treedir by searching backwards for correct depth",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9502 " call Decho("initial treedir<".treedir."> depth<".depth.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9503 while depth != "" && search('^'.depth.'[^'.s:treedepthstring.'].\{-}/$','bW')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9504 let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9505 let treedir= dirname.treedir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9506 let depth = substitute(depth,'^'.s:treedepthstring,'','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9507 " call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9508 endwhile
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9509 " call Decho("treedir#1<".treedir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9510 if a:treetop =~ '/$'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9511 let treedir= a:treetop.treedir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9512 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9513 let treedir= a:treetop.'/'.treedir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9514 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9515 " call Decho("treedir#2<".treedir.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9516 let treedir= substitute(treedir,'//$','/','')
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9517 " call Decho("treedir#3<".treedir.">",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9518 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9519 call winrestview(svpos)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9520 " call Dret("s:NetrwTreePath <".treedir.">")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9521 return treedir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9522 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9523
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9524 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9525 " s:NetrwWideListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9526 fun! s:NetrwWideListing()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9527
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9528 if w:netrw_liststyle == s:WIDELIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9529 " 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
9530 " look for longest filename (cpf=characters per filename)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9531 " cpf: characters per filename
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9532 " fpl: filenames per line
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9533 " fpc: filenames per column
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9534 setl ma noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9535 " call Decho("setl ma noro",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9536 let b:netrw_cpf= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9537 if line("$") >= w:netrw_bannercnt
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9538 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9539 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9540 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9541 " call Dret("NetrwWideListing")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9542 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9543 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9544 let b:netrw_cpf= b:netrw_cpf + 2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9545 " call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9546
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9547 " determine qty files per line (fpl)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9548 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9549 if w:netrw_fpl <= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9550 let w:netrw_fpl= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9551 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9552 " call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9553
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9554 " make wide display
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9555 " fpc: files per column of wide listing
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9556 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'S",submatch(0)),"\\")/'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9557 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9558 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9559 let newcolstart = w:netrw_bannercnt + fpc
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9560 let newcolend = newcolstart + fpc - 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9561 " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9562 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9563 sil! let keepregstar = @*
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9564 sil! let keepregplus = @+
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9565 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9566 while line("$") >= newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9567 if newcolend > line("$") | let newcolend= line("$") | endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9568 let newcolqty= newcolend - newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9569 exe newcolstart
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9570 if newcolqty == 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9571 exe "sil! NetrwKeepj norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9572 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9573 exe "sil! NetrwKeepj norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9574 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9575 exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d _'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9576 exe 'sil! NetrwKeepj '.w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9577 endwhile
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9578 if has("clipboard")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9579 sil! let @*= keepregstar
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9580 sil! let @+= keepregplus
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9581 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9582 exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9583 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9584 exe 'nno <buffer> <silent> w :call search(''^.\\|\s\s\zs\S'',''W'')'."\<cr>"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9585 exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9586 " call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
9587 exe "setl ".g:netrw_bufsettings
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9588 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9589 " call Dret("NetrwWideListing")
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
9590 return
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9591 else
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9592 if hasmapto("w","n")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9593 sil! nunmap <buffer> w
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9594 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9595 if hasmapto("b","n")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9596 sil! nunmap <buffer> b
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9597 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9598 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9599
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9600 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9601
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9602 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9603 " s:PerformListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9604 fun! s:PerformListing(islocal)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9605 " call Dfunc("s:PerformListing(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9606 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9607 " call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)"." ei<".&ei.">",'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9608 sil! NetrwKeepj %d _
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9609 " call DechoBuf(bufnr("%"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9610
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
9611 " set up syntax highlighting {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9612 " call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9613 sil! setl ft=netrw
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9614
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9615 NetrwKeepj call s:NetrwOptionsSafe(a:islocal)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9616 setl noro ma
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9617 " call Decho("setl noro ma bh=".&bh,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9618
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9619 " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9620 " call Decho("Processing your browsing request...",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9621 " endif " Decho
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9622
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9623 " call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9624 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
9625 " force a refresh for tree listings
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9626 " call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9627 sil! NetrwKeepj %d _
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9628 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9629
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9630 " save current directory on directory history list
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9631 NetrwKeepj call s:NetrwBookHistHandler(3,b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9632
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9633 " Set up the banner {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9634 if g:netrw_banner
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9635 " call Decho("--set up banner",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9636 NetrwKeepj call setline(1,'" ============================================================================')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9637 if exists("g:netrw_pchk")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9638 " this undocumented option allows pchk to run with different versions of netrw without causing spurious
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9639 " failure detections.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9640 NetrwKeepj call setline(2,'" Netrw Directory Listing')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9641 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9642 NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9643 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9644 if exists("g:netrw_pchk")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9645 let curdir= substitute(b:netrw_curdir,expand("$HOME"),'~','')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9646 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9647 let curdir= b:netrw_curdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9648 endif
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9649 if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9650 NetrwKeepj call setline(3,'" '.substitute(curdir,'/','\\','g'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9651 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9652 NetrwKeepj call setline(3,'" '.curdir)
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
9653 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9654 let w:netrw_bannercnt= 3
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9655 NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9656 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9657 " call Decho("--no banner",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9658 NetrwKeepj 1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9659 let w:netrw_bannercnt= 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9660 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9661 " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9662 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9663
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9664 " construct sortby string: [name|time|size|exten] [reversed]
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9665 let sortby= g:netrw_sort_by
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9666 if g:netrw_sort_direction =~# "^r"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9667 let sortby= sortby." reversed"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9668 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9669
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9670 " Sorted by... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9671 if g:netrw_banner
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9672 " call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9673 if g:netrw_sort_by =~# "^n"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9674 " call Decho("directories will be sorted by name",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9675 " sorted by name (also includes the sorting sequence in the banner)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9676 NetrwKeepj put ='\" Sorted by '.sortby
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9677 NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9678 let w:netrw_bannercnt= w:netrw_bannercnt + 2
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9679 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9680 " call Decho("directories will be sorted by size or time",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9681 " sorted by time, size, exten
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9682 NetrwKeepj put ='\" Sorted by '.sortby
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9683 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9684 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9685 exe "sil! NetrwKeepj ".w:netrw_bannercnt
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9686 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9687 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9688 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9689
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9690 " show copy/move target, if any {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9691 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9692 if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9693 " call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9694 NetrwKeepj put =''
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9695 if s:netrwmftgt_islocal
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9696 sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9697 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9698 sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9699 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9700 let w:netrw_bannercnt= w:netrw_bannercnt + 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9701 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9702 " call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9703 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9704 exe "sil! NetrwKeepj ".w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9705 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9706
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9707 " Hiding... -or- Showing... {{{3
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9708 if g:netrw_banner
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9709 " call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9710 if g:netrw_list_hide != "" && g:netrw_hide
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9711 if g:netrw_hide == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9712 NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9713 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9714 NetrwKeepj put ='\" Showing: '.g:netrw_list_hide
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9715 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9716 let w:netrw_bannercnt= w:netrw_bannercnt + 1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9717 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9718 exe "NetrwKeepj ".w:netrw_bannercnt
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9719
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9720 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9721 let quickhelp = g:netrw_quickhelp%len(s:QuickHelp)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9722 " call Decho("quickhelp =".quickhelp,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9723 NetrwKeepj put ='\" Quick Help: <F1>:help '.s:QuickHelp[quickhelp]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9724 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9725 NetrwKeepj put ='\" =============================================================================='
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9726 let w:netrw_bannercnt= w:netrw_bannercnt + 2
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9727 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9728 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9729 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9730
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9731 " bannercnt should index the line just after the banner
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9732 if g:netrw_banner
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9733 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9734 exe "sil! NetrwKeepj ".w:netrw_bannercnt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9735 " call Decho("--w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"),'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9736 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9737 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9738 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9739
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9740 " get list of files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9741 " call Decho("--Get list of files - islocal=".a:islocal,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9742 if a:islocal
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9743 NetrwKeepj call s:LocalListing()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9744 else " remote
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9745 NetrwKeepj let badresult= s:NetrwRemoteListing()
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9746 if badresult
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9747 " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9748 " call Dret("s:PerformListing : error detected by NetrwRemoteListing")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9749 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9750 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9751 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9752
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9753 " manipulate the directory listing (hide, sort) {{{3
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
9754 if !exists("w:netrw_bannercnt")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
9755 let w:netrw_bannercnt= 0
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
9756 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9757 " call Decho("--manipulate directory listing (hide, sort)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9758 " call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9759 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9760
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9761 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9762 " call Decho("manipulate directory listing (hide)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9763 " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9764 if g:netrw_hide && g:netrw_list_hide != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9765 NetrwKeepj call s:NetrwListHide()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9766 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9767 if !g:netrw_banner || line("$") >= w:netrw_bannercnt
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9768 " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9769
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9770 if g:netrw_sort_by =~# "^n"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9771 " sort by name
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9772 " call Decho("sort by name",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9773 NetrwKeepj call s:NetrwSetSort()
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9774
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9775 if !g:netrw_banner || w:netrw_bannercnt < line("$")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9776 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9777 if g:netrw_sort_direction =~# 'n'
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9778 " name: sort by name of file
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9779 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9780 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9781 " reverse direction sorting
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9782 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9783 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9784 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9785 " remove priority pattern prefix
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9786 " call Decho("remove priority pattern prefix",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9787 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9788 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9789
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9790 elseif g:netrw_sort_by =~# "^ext"
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9791 " exten: sort by extension
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9792 " The histdel(...,-1) calls remove the last search from the search history
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9793 " call Decho("sort by extension",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9794 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9795 NetrwKeepj call histdel("/",-1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9796 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9797 NetrwKeepj call histdel("/",-1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9798 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+['.g:netrw_sepchr.'/]+s/^\(.*\.\)\(.\{-\}\)$/\2'.g:netrw_sepchr.'&/e'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9799 NetrwKeepj call histdel("/",-1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9800 if !g:netrw_banner || w:netrw_bannercnt < line("$")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9801 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9802 if g:netrw_sort_direction =~# 'n'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9803 " normal direction sorting
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9804 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9805 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9806 " reverse direction sorting
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9807 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9808 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9809 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9810 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^.\{-}'.g:netrw_sepchr.'//e'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9811 NetrwKeepj call histdel("/",-1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9812
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9813 elseif a:islocal
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9814 if !g:netrw_banner || w:netrw_bannercnt < line("$")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9815 " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9816 if g:netrw_sort_direction =~# 'n'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9817 " call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9818 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9819 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9820 " call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9821 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9822 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9823 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9824 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9825 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9826 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9827
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
9828 elseif g:netrw_sort_direction =~# 'r'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9829 " call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9830 if !g:netrw_banner || w:netrw_bannercnt < line('$')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9831 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9832 call histdel("/",-1)
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
9833 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9834 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9835 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9836 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9837
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9838 " convert to wide/tree listing {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9839 " call Decho("--modify display if wide/tree listing style",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9840 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9841 NetrwKeepj call s:NetrwWideListing()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9842 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9843 NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9844 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9845
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9846 " resolve symbolic links if local and (thin or tree)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9847 if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9848 " call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9849 sil! g/@$/call s:ShowLink()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9850 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9851
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9852 if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9853 " place cursor on the top-left corner of the file listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9854 " call Decho("--place cursor on top-left corner of file listing",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9855 exe 'sil! '.w:netrw_bannercnt
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9856 sil! NetrwKeepj norm! 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9857 " call Decho(" tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9858 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9859 " call Decho("--did NOT place cursor on top-left corner",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9860 " call Decho(" w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9861 " call Decho(" line($)=".line("$"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9862 " call Decho(" g:netrw_banner=".(exists("g:netrw_banner")? g:netrw_banner : 'n/a'),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9863 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9864
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9865 " record previous current directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9866 let w:netrw_prvdir= b:netrw_curdir
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9867 " call Decho("--record netrw_prvdir<".w:netrw_prvdir.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9868
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9869 " save certain window-oriented variables into buffer-oriented variables {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9870 " call Decho("--save some window-oriented variables into buffer oriented variables",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9871 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9872 NetrwKeepj call s:SetBufWinVars()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9873 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9874 NetrwKeepj call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9875 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9876
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9877 " set display to netrw display settings
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9878 " call Decho("--set display to netrw display settings (".g:netrw_bufsettings.")",'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
9879 exe "setl ".g:netrw_bufsettings
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9880 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
9881 if g:netrw_liststyle == s:LONGLIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9882 " call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
9883 exe "setl ts=".(g:netrw_maxfilenamelen+1)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
9884 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9885 " call DechoBuf(bufnr("%"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
9886
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9887 if exists("s:treecurpos")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9888 " call Decho("s:treecurpos exists; restore posn",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9889 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9890 " call Decho("restoring posn to s:treecurpos<".string(s:treecurpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9891 NetrwKeepj call winrestview(s:treecurpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9892 unlet s:treecurpos
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9893 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9894
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9895 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9896 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9897 " call Dret("s:PerformListing : curpos<".string(getpos(".")).">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9898 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9899
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9900 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9901 " s:SetupNetrwStatusLine: {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9902 fun! s:SetupNetrwStatusLine(statline)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9903 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9904
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9905 if !exists("s:netrw_setup_statline")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9906 let s:netrw_setup_statline= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9907 " call Decho("do first-time status line setup",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9908
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9909 if !exists("s:netrw_users_stl")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9910 let s:netrw_users_stl= &stl
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9911 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9912 if !exists("s:netrw_users_ls")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9913 let s:netrw_users_ls= &laststatus
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9914 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9915
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9916 " set up User9 highlighting as needed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9917 let keepa= @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9918 redir @a
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9919 try
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9920 hi User9
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9921 catch /^Vim\%((\a\{3,})\)\=:E411/
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9922 if &bg == "dark"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9923 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9924 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9925 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9926 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9927 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9928 redir END
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9929 let @a= keepa
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9930 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9931
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9932 " set up status line (may use User9 highlighting)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9933 " insure that windows have a statusline
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9934 " make sure statusline is displayed
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9935 let &stl=a:statline
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
9936 setl laststatus=2
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9937 " call Decho("stl=".&stl,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9938 redraw
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9939
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9940 " call Dret("SetupNetrwStatusLine : stl=".&stl)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9941 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
9942
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9943 " =========================================
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9944 " Remote Directory Browsing Support: {{{1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
9945 " =========================================
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9946
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
9947 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9948 " s:NetrwRemoteFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9949 " This function assumes that a long listing will be received. Size, time,
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9950 " and reverse sorts will be requested of the server but not otherwise
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9951 " enforced here.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9952 fun! s:NetrwRemoteFtpCmd(path,listcmd)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9953 " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???")))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9954 " call Decho("line($)=".line("$")." win#".winnr()." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9955 " sanity check: {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9956 if !exists("w:netrw_method")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9957 if exists("b:netrw_method")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9958 let w:netrw_method= b:netrw_method
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9959 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9960 call netrw#ErrorMsg(2,"(s:NetrwRemoteFtpCmd) internal netrw error",93)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9961 " call Dret("NetrwRemoteFtpCmd")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9962 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9963 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9964 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9965
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9966 " WinXX ftp uses unix style input, so set ff to unix " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9967 let ffkeep= &ff
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9968 setl ma ff=unix noro
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9969 " call Decho("setl ma ff=unix noro",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9970
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9971 " clear off any older non-banner lines " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9972 " note that w:netrw_bannercnt indexes the line after the banner
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9973 " call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d _ (clear off old non-banner lines)",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
9974 exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d _"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9975
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9976 ".........................................
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9977 if w:netrw_method == 2 || w:netrw_method == 5 " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9978 " ftp + <.netrc>: Method #2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9979 if a:path != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9980 NetrwKeepj put ='cd \"'.a:path.'\"'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9981 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9982 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9983 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9984 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9985 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
9986 NetrwKeepj call setline(line("$")+1,a:listcmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9987 " exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9988 if exists("g:netrw_port") && g:netrw_port != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9989 " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9990 exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9991 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9992 " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
9993 exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9994 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9995
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9996 ".........................................
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9997 elseif w:netrw_method == 3 " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9998 " ftp + machine,id,passwd,filename: Method #3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
9999 setl ff=unix
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10000 if exists("g:netrw_port") && g:netrw_port != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10001 NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10002 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10003 NetrwKeepj put ='open '.g:netrw_machine
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10004 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10005
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10006 " handle userid and password
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10007 let host= substitute(g:netrw_machine,'\..*$','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10008 " call Decho("host<".host.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10009 if exists("s:netrw_hup") && exists("s:netrw_hup[host]")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10010 call NetUserPass("ftp:".host)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10011 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10012 if exists("g:netrw_uid") && g:netrw_uid != ""
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10013 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10014 NetrwKeepj put =g:netrw_uid
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10015 if exists("s:netrw_passwd") && s:netrw_passwd != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10016 NetrwKeepj put ='\"'.s:netrw_passwd.'\"'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10017 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10018 elseif exists("s:netrw_passwd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10019 NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10020 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10021 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10022
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10023 if a:path != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10024 NetrwKeepj put ='cd \"'.a:path.'\"'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10025 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10026 if exists("g:netrw_ftpextracmd")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10027 NetrwKeepj put =g:netrw_ftpextracmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10028 " call Decho("filter input: ".getline('.'),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10029 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10030 NetrwKeepj call setline(line("$")+1,a:listcmd)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10031
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10032 " perform ftp:
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10033 " -i : turns off interactive prompting from ftp
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10034 " -n unix : DON'T use <.netrc>, even though it exists
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10035 " -n win32: quit being obnoxious about password
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10036 if exists("w:netrw_bannercnt")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10037 " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand("<slnum>"))'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10038 call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10039 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10040 " call Decho("WARNING: w:netrw_bannercnt doesn't exist!",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10041 " g/^./call Decho("SKIPPING ftp#".line(".").": ".getline("."),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10042 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10043
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10044 ".........................................
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10045 elseif w:netrw_method == 9 " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10046 " sftp username@machine: Method #9
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10047 " s:netrw_sftp_cmd
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10048 setl ff=unix
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10049
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10050 " restore settings
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10051 let &ff= ffkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10052 " call Dret("NetrwRemoteFtpCmd")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10053 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10054
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10055 ".........................................
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10056 else " {{{3
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10057 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10058 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10059
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10060 " cleanup for Windows " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10061 if has("win32") || has("win95") || has("win64") || has("win16")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10062 sil! NetrwKeepj %s/\r$//e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10063 NetrwKeepj call histdel("/",-1)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10064 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10065 if a:listcmd == "dir"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10066 " infer directory/link based on the file permission string
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10067 sil! NetrwKeepj g/d\%([-r][-w][-x]\)\{3}/NetrwKeepj s@$@/@e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10068 sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10069 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10070 NetrwKeepj call histdel("/",-1)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10071 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10072 exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10073 NetrwKeepj call histdel("/",-1)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10074 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10075 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10076
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10077 " ftp's listing doesn't seem to include ./ or ../ " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10078 if !search('^\.\/$\|\s\.\/$','wn')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10079 exe 'NetrwKeepj '.w:netrw_bannercnt
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10080 NetrwKeepj put ='./'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10081 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10082 if !search('^\.\.\/$\|\s\.\.\/$','wn')
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10083 exe 'NetrwKeepj '.w:netrw_bannercnt
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10084 NetrwKeepj put ='../'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10085 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10086
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10087 " restore settings " {{{3
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10088 let &ff= ffkeep
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10089 " call Dret("NetrwRemoteFtpCmd")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10090 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10091
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10092 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10093 " s:NetrwRemoteListing: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10094 fun! s:NetrwRemoteListing()
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10095 " call Dfunc("s:NetrwRemoteListing() b:netrw_curdir<".b:netrw_curdir.">) win#".winnr())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10096
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10097 if !exists("w:netrw_bannercnt") && exists("s:bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10098 let w:netrw_bannercnt= s:bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10099 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10100 if !exists("w:netrw_bannercnt") && exists("b:bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10101 let w:netrw_bannercnt= s:bannercnt
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10102 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10103
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10104 call s:RemotePathAnalysis(b:netrw_curdir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10105
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10106 " sanity check:
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10107 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10108 " call Decho("b:netrw_method=".b:netrw_method,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10109 if !executable("ftp")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10110 " call Decho("ftp is not executable",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10111 if !exists("g:netrw_quiet")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10112 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
10113 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10114 call s:NetrwOptionsRestore("w:")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10115 " call Dret("s:NetrwRemoteListing -1")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10116 return -1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10117 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10118
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10119 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10120 " call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10121 if !exists("g:netrw_quiet")
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10122 if g:netrw_list_cmd == ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10123 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10124 else
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10125 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10126 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10127 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10128
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10129 NetrwKeepj call s:NetrwOptionsRestore("w:")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10130 " call Dret("s:NetrwRemoteListing -1")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10131 return -1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10132 endif " (remote handling sanity check)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10133 " call Decho("passed remote listing sanity checks",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10134
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10135 if exists("b:netrw_method")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10136 " call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10137 let w:netrw_method= b:netrw_method
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10138 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10139
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
10140 if s:method == "ftp"
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
10141 " use ftp to get remote file listing {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10142 " call Decho("use ftp to get remote file listing",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10143 let s:method = "ftp"
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10144 let listcmd = g:netrw_ftp_list_cmd
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10145 if g:netrw_sort_by =~# '^t'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10146 let listcmd= g:netrw_ftp_timelist_cmd
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10147 elseif g:netrw_sort_by =~# '^s'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10148 let listcmd= g:netrw_ftp_sizelist_cmd
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10149 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10150 " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10151 call s:NetrwRemoteFtpCmd(s:path,listcmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10152 " exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."),''~''.expand("<slnum>"))'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10153
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10154 " report on missing file or directory messages
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10155 if search('[Nn]o such file or directory\|Failed to change directory')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10156 let mesg= getline(".")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10157 if exists("w:netrw_bannercnt")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10158 setl ma
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10159 exe w:netrw_bannercnt.",$d _"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10160 setl noma
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10161 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10162 NetrwKeepj call s:NetrwOptionsRestore("w:")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10163 call netrw#ErrorMsg(s:WARNING,mesg,96)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10164 " call Dret("s:NetrwRemoteListing : -1")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10165 return -1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10166 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10167
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10168 if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10169 " shorten the listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10170 " call Decho("generate short listing",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10171 exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10172
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10173 " cleanup
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10174 if g:netrw_ftp_browse_reject != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10175 exe "sil! keepalt NetrwKeepj g/".g:netrw_ftp_browse_reject."/NetrwKeepj d"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10176 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10177 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10178 sil! NetrwKeepj %s/\r$//e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10179 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10180
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
10181 " if there's no ../ listed, then put ../ in
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10182 let line1= line(".")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10183 exe "sil! NetrwKeepj ".w:netrw_bannercnt
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10184 let line2= search('\.\.\/\%(\s\|$\)','cnW')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10185 " call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10186 if line2 == 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10187 " call Decho("netrw is putting ../ into listing",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10188 sil! NetrwKeepj put='../'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10189 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10190 exe "sil! NetrwKeepj ".line1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10191 sil! NetrwKeepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10192
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10193 " call Decho("line1=".line1." line2=".line2." line(.)=".line("."),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10194 if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10195 " call Decho("M$ ftp cleanup",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10196 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(<DIR>\|\d\+\)\s\+//'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10197 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10198 else " normal ftp cleanup
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10199 " call Decho("normal ftp cleanup",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10200 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10201 exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10202 exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10203 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10204 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10205 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10206 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10207 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10208
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
10209 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10210 " use ssh to get remote file listing {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10211 " call Decho("use ssh to get remote file listing: s:path<".s:path.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10212 let listcmd= s:MakeSshCmd(g:netrw_list_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10213 " call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10214 if g:netrw_scp_cmd =~ '^pscp'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10215 " call Decho("1: exe r! ".s:ShellEscape(listcmd.s:path, 1),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10216 exe "NetrwKeepj r! ".listcmd.s:ShellEscape(s:path, 1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10217 " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10218 sil! NetrwKeepj g/^Listing directory/NetrwKeepj d
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10219 sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10220 sil! NetrwKeepj g/^l[-rwx][-rwx][-rwx]/NetrwKeepj s+$+@+e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10221 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10222 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10223 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10224 if g:netrw_liststyle != s:LONGLIST
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10225 sil! NetrwKeepj g/^[dlsp-][-rwx][-rwx][-rwx]/NetrwKeepj s/^.*\s\(\S\+\)$/\1/e
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10226 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10227 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10228 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10229 if s:path == ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10230 " call Decho("2: exe r! ".listcmd,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10231 exe "NetrwKeepj keepalt r! ".listcmd
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10232 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10233 " call Decho("3: exe r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10234 exe "NetrwKeepj keepalt r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10235 " call Decho("listcmd<".listcmd."> path<".s:path.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10236 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10237 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10238
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10239 " cleanup
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10240 if g:netrw_ssh_browse_reject != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10241 " call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10242 exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10243 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10244 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10245 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10246
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10247 if w:netrw_liststyle == s:LONGLIST
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10248 " do a long listing; these substitutions need to be done prior to sorting {{{3
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10249 " call Decho("fix long listing:",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10250
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10251 if s:method == "ftp"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10252 " cleanup
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10253 exe "sil! NetrwKeepj ".w:netrw_bannercnt
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10254 while getline('.') =~# g:netrw_ftp_browse_reject
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10255 sil! NetrwKeepj d
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10256 endwhile
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
10257 " if there's no ../ listed, then put ../ in
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10258 let line1= line(".")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10259 sil! NetrwKeepj 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10260 sil! NetrwKeepj call search('^\.\.\/\%(\s\|$\)','W')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10261 let line2= line(".")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10262 if line2 == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10263 if b:netrw_curdir != '/'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10264 exe 'sil! NetrwKeepj '.w:netrw_bannercnt."put='../'"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10265 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10266 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10267 exe "sil! NetrwKeepj ".line1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10268 sil! NetrwKeepj norm! 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10269 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10270
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10271 if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10272 " call Decho("M$ ftp site listing cleanup",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10273 exe 'sil! NetrwKeepj '.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
10274 elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10275 " call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10276 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10277 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2 \t\1/e'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10278 exe 'sil NetrwKeepj '.w:netrw_bannercnt
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10279 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10280 NetrwKeepj call histdel("/",-1)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10281 NetrwKeepj call histdel("/",-1)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10282 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10283 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10284
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10285 " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10286 " exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."),''~''.expand("<slnum>"))'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10287 " endif " Decho
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10288
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10289 " call Dret("s:NetrwRemoteListing 0")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10290 return 0
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10291 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10292
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10293 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10294 " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10295 fun! s:NetrwRemoteRm(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10296 " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10297 " call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10298 let svpos= winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10299 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10300
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10301 let all= 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10302 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10303 " remove all marked files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10304 " call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10305 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10306 let ok= s:NetrwRemoteRmFile(a:path,fname,all)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10307 if ok =~# 'q\%[uit]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10308 break
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10309 elseif ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10310 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10311 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10312 endfor
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10313 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10314
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10315 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10316 " remove files specified by range
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10317 " call Decho("remove files specified by range",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10318
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10319 " preparation for removing multiple files/directories
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10320 let keepsol = &l:sol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10321 setl nosol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10322 let ctr = a:firstline
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10323
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10324 " remove multiple files and directories
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10325 while ctr <= a:lastline
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10326 exe "NetrwKeepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10327 let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10328 if ok =~# 'q\%[uit]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10329 break
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10330 elseif ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10331 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10332 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10333 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10334 endwhile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10335 let &l:sol = keepsol
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10336 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10337
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10338 " refresh the (remote) directory listing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10339 " call Decho("refresh remote directory listing",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10340 NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10341 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10342 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10343
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10344 " call Dret("s:NetrwRemoteRm")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
10345 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
10346
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
10347 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10348 " s:NetrwRemoteRmFile: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10349 fun! s:NetrwRemoteRmFile(path,rmfile,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10350 " call Dfunc("s:NetrwRemoteRmFile(path<".a:path."> rmfile<".a:rmfile.">) all=".a:all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10351
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10352 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10353 let ok = ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10354
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10355 if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10356 " attempt to remove file
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10357 " call Decho("attempt to remove file (all=".all.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10358 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10359 echohl Statement
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10360 " call Decho("case all=0:",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10361 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10362 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
10363 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10364 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10365 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10366 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10367 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10368 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10369 if ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10370 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10371 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10372 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10373
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10374 if all || ok =~# 'y\%[es]' || ok == ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10375 " call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10376 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10377 " call Decho("case ftp:",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10378 let path= a:path
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10379 if path =~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10380 let path= substitute(path,'^\a\{3,}://[^/]\+/','','')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10381 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10382 sil! NetrwKeepj .,$d _
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10383 call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10384 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10385 " call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10386 let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10387 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10388 if !exists("b:netrw_curdir")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10389 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10390 let ok="q"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10391 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10392 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10393 " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10394 " call Decho("remotedir<".remotedir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10395 " call Decho("rmfile<".a:rmfile.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10396 if remotedir != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10397 let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(remotedir.a:rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10398 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10399 let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(a:rmfile))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10400 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10401 " call Decho("call system(".netrw_rm_cmd.")",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10402 let ret= system(netrw_rm_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10403 if v:shell_error != 0
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10404 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10405 call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10406 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10407 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10408 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10409 elseif ret != 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10410 call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10411 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10412 " call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10413 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10414 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10415 elseif ok =~# 'q\%[uit]'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10416 " call Decho("ok==".ok,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10417 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10418
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10419 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10420 " attempt to remove directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10421 " call Decho("attempt to remove directory",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10422 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10423 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10424 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
10425 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10426 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10427 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10428 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10429 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10430 if ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10431 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10432 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10433 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10434
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10435 if all || ok =~# 'y\%[es]' || ok == ""
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10436 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10437 NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10438 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10439 let rmfile = substitute(a:path.a:rmfile,'/$','','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10440 let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.s:ShellEscape(netrw#WinPath(rmfile))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10441 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
10442 let ret= system(netrw_rmdir_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10443 " call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10444
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10445 if v:shell_error != 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10446 " call Decho("v:shell_error not 0",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10447 let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.s:ShellEscape(netrw#WinPath(substitute(rmfile,'[\/]$','','e')))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10448 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
10449 let ret= system(netrw_rmf_cmd)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10450 " call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10451
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10452 if v:shell_error != 0 && !exists("g:netrw_quiet")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10453 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10454 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10455 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10456 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10457
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10458 elseif ok =~# 'q\%[uit]'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10459 " call Decho("ok==".ok,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10460 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10461 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10462
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10463 " call Dret("s:NetrwRemoteRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10464 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10465 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10466
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10467 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10468 " s:NetrwRemoteRename: rename a remote file or directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10469 fun! s:NetrwRemoteRename(usrhost,path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10470 " call Dfunc("NetrwRemoteRename(usrhost<".a:usrhost."> path<".a:path.">)")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10471
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10472 " preparation for removing multiple files/directories
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10473 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10474 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10475 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10476 let rename_cmd = s:MakeSshCmd(g:netrw_rename_cmd)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10477
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10478 " rename files given by the markfilelist
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10479 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10480 for oldname in s:netrwmarkfilelist_{bufnr("%")}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10481 " call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10482 if exists("subfrom")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10483 let newname= substitute(oldname,subfrom,subto,'')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10484 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10485 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10486 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10487 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10488 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10489 if newname =~ '^s/'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10490 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10491 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10492 let newname = substitute(oldname,subfrom,subto,'')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10493 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10494 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10495 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10496
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10497 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10498 NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10499 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10500 let oldname= s:ShellEscape(a:path.oldname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10501 let newname= s:ShellEscape(a:path.newname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10502 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10503 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10504 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10505
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10506 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10507 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10508
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10509 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10510
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10511 " attempt to rename files/directories
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10512 let keepsol= &l:sol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10513 setl nosol
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10514 while ctr <= a:lastline
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10515 exe "NetrwKeepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10516
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10517 let oldname= s:NetrwGetWord()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10518 " call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10519
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10520 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10521 let newname= input("Moving ".oldname." to : ",oldname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10522 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10523
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10524 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10525 call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10526 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10527 let oldname= s:ShellEscape(a:path.oldname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10528 let newname= s:ShellEscape(a:path.newname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10529 " call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10530 let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10531 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10532
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10533 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10534 endwhile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10535 let &l:sol= keepsol
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10536 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10537
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10538 " refresh the directory
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10539 NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10540 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10541 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10542
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10543 " call Dret("NetrwRemoteRename")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10544 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10545
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10546 " ==========================================
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10547 " Local Directory Browsing Support: {{{1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10548 " ==========================================
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10549
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10550 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10551 " netrw#FileUrlEdit: handles editing file://* files {{{2
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10552 " Should accept: file://localhost/etc/fstab
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10553 " file:///etc/fstab
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10554 " file:///c:/WINDOWS/clock.avi
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10555 " file:///c|/WINDOWS/clock.avi
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10556 " file://localhost/c:/WINDOWS/clock.avi
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10557 " file://localhost/c|/WINDOWS/clock.avi
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10558 " file://c:/foo.txt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10559 " file:///c:/foo.txt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10560 " and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10561 fun! netrw#FileUrlEdit(fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10562 " call Dfunc("netrw#FileUrlEdit(fname<".a:fname.">)")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10563 let fname = a:fname
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10564 if fname =~ '^file://localhost/'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10565 " call Decho('converting file://localhost/ -to- file:///','~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10566 let fname= substitute(fname,'^file://localhost/','file:///','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10567 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10568 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10569 if (has("win32") || has("win95") || has("win64") || has("win16"))
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10570 if fname =~ '^file:///\=\a[|:]/'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10571 " call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10572 let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10573 " call Decho("fname<".fname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10574 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10575 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10576 let fname2396 = netrw#RFC2396(fname)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10577 let fname2396e= fnameescape(fname2396)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10578 let plainfname= substitute(fname2396,'file://\(.*\)','\1',"")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10579 if (has("win32") || has("win95") || has("win64") || has("win16"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10580 " call Decho("windows exception for plainfname",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10581 if plainfname =~ '^/\+\a:'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10582 " call Decho('removing leading "/"s','~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10583 let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','')
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10584 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10585 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10586
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10587 " call Decho("fname2396<".fname2396.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10588 " call Decho("plainfname<".plainfname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10589 exe "sil doau BufReadPre ".fname2396e
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10590 exe 'NetrwKeepj keepalt edit '.plainfname
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10591 exe 'sil! NetrwKeepj keepalt bdelete '.fnameescape(a:fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10592
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10593 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10594 " call Dret("netrw#FileUrlEdit")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10595 exe "sil doau BufReadPost ".fname2396e
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10596 endfun
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10597
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10598 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10599 " netrw#LocalBrowseCheck: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10600 fun! netrw#LocalBrowseCheck(dirname)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10601 " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(),
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10602 " and by <cr> when atop a listed file/directory (via a buffer-local map)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10603 "
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10604 " unfortunate interaction -- split window debugging can't be used here, must use
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10605 " D-echoRemOn or D-echoTabOn as the BufEnter event triggers
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10606 " another call to LocalBrowseCheck() when attempts to write
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10607 " to the DBG buffer are made.
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10608 "
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10609 " The &ft == "netrw" test was installed because the BufEnter event
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10610 " would hit when re-entering netrw windows, creating unexpected
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10611 " refreshes (and would do so in the middle of NetrwSaveOptions(), too)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10612 " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">)")
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10613 " call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10614 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10615 " call Dredir("ls!","netrw#LocalBrowseCheck")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10616 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10617 " call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10618
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10619 let ykeep= @@
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10620 if isdirectory(s:NetrwFile(a:dirname))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10621 " call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10622
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10623 if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10624 " call Decho("case 1 : ft=".&ft,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10625 " call Decho("s:rexposn_".bufnr("%")."<".bufname("%")."> ".(exists("s:rexposn_".bufnr("%"))? "exists" : "does not exist"),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10626 sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10627
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10628 elseif &ft == "netrw" && line("$") == 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10629 " call Decho("case 2 (ft≡netrw && line($)≡1)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10630 sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10631
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10632 elseif exists("s:treeforceredraw")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10633 " call Decho("case 3 (treeforceredraw)",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10634 unlet s:treeforceredraw
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10635 sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10636 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10637 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10638 " call Dret("netrw#LocalBrowseCheck")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10639 return
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10640 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
10641
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10642 " The following code wipes out currently unused netrw buffers
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10643 " IF g:netrw_fastbrowse is zero (ie. slow browsing selected)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10644 " AND IF the listing style is not a tree listing
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10645 if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10646 " call Decho("wiping out currently unused netrw buffers",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10647 let ibuf = 1
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10648 let buflast = bufnr("$")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10649 while ibuf <= buflast
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10650 if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf)))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10651 exe "sil! keepj keepalt ".ibuf."bw!"
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10652 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10653 let ibuf= ibuf + 1
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10654 endwhile
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10655 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10656 let @@= ykeep
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10657 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10658 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10659 " not a directory, ignore it
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10660 " call Dret("netrw#LocalBrowseCheck : not a directory, ignoring it; dirname<".a:dirname.">")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10661 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10662
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10663 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10664 " s:LocalBrowseRefresh: this function is called after a user has {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10665 " performed any shell command. The idea is to cause all local-browsing
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10666 " buffers to be refreshed after a user has executed some shell command,
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10667 " on the chance that s/he removed/created a file/directory with it.
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10668 fun! s:LocalBrowseRefresh()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10669 " call Dfunc("s:LocalBrowseRefresh() tabpagenr($)=".tabpagenr("$"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10670 " call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '<n/a>'),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10671 " call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '<n/a>'),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10672
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10673 " determine which buffers currently reside in a tab
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10674 if !exists("s:netrw_browselist")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10675 " call Dret("s:LocalBrowseRefresh : browselist is empty")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10676 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10677 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10678 if !exists("w:netrw_bannercnt")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10679 " call Dret("s:LocalBrowseRefresh : don't refresh when focus not on netrw window")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10680 return
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10681 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10682 if exists("s:netrw_events") && s:netrw_events == 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10683 " s:LocalFastBrowser gets called (indirectly) from a
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10684 let s:netrw_events= 2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10685 " call Dret("s:LocalBrowseRefresh : avoid initial double refresh")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10686 return
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
10687 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10688 let itab = 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10689 let buftablist = []
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10690 let ykeep = @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10691 while itab <= tabpagenr("$")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10692 let buftablist = buftablist + tabpagebuflist()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10693 let itab = itab + 1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10694 sil! tabn
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
10695 endwhile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10696 " call Decho("buftablist".string(buftablist),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10697 " call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10698 " GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10699 " | refresh any netrw window
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10700 " | wipe out any non-displaying netrw buffer
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10701 let curwinid = win_getid(winnr())
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10702 let ibl = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10703 for ibuf in s:netrw_browselist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10704 " call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10705 if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10706 " wipe out any non-displaying netrw buffer
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10707 " (ibuf not shown in a current window AND
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10708 " ibuf not in any tab)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10709 " call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10710 exe "sil! keepj bd ".fnameescape(ibuf)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10711 call remove(s:netrw_browselist,ibl)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10712 " call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10713 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10714 elseif index(tabpagebuflist(),ibuf) != -1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10715 " refresh any netrw buffer
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10716 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10717 exe bufwinnr(ibuf)."wincmd w"
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10718 if getline(".") =~# 'Quick Help'
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10719 " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10720 " (counteracts s:NetrwBrowseChgDir()'s incrementing)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10721 let g:netrw_quickhelp= g:netrw_quickhelp - 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10722 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10723 " call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10724 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10725 NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10726 endif
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10727 NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10728 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10729 let ibl= ibl + 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10730 " call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10731 endfor
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10732 " call Decho("restore window: win_gotoid(".curwinid.")")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10733 call win_gotoid(curwinid)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10734 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10735
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10736 " call Dret("s:LocalBrowseRefresh")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10737 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10738
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
10739 " ---------------------------------------------------------------------
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10740 " s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10741 "
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10742 " g:netrw_ Directory Is
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10743 " fastbrowse Local Remote
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10744 " slow 0 D D D=Deleting a buffer implies it will not be re-used (slow)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10745 " med 1 D H H=Hiding a buffer implies it may be re-used (fast)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10746 " fast 2 H H
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10747 "
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10748 " Deleting a buffer means that it will be re-loaded when examined, hence "slow".
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10749 " Hiding a buffer means that it will be re-used when examined, hence "fast".
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10750 " (re-using a buffer may not be as accurate)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10751 "
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10752 " s:netrw_events : doesn't exist, s:LocalFastBrowser() will install autocmds whena med or fast browsing
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10753 " =1: autocmds installed, but ignore next FocusGained event to avoid initial double-refresh of listing.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10754 " BufEnter may be first event, then a FocusGained event. Ignore the first FocusGained event.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10755 " If :Explore used: it sets s:netrw_events to 2, so no FocusGained events are ignored.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10756 " =2: autocmds installed (doesn't ignore any FocusGained events)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10757 fun! s:LocalFastBrowser()
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10758 " call Dfunc("s:LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10759 " call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10760 " call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "already installed" : "not installed"),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10761 " call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "already installed" : "not installed"),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10762
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10763 " initialize browselist, a list of buffer numbers that the local browser has used
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10764 if !exists("s:netrw_browselist")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10765 " call Decho("initialize s:netrw_browselist",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10766 let s:netrw_browselist= []
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10767 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10768
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10769 " append current buffer to fastbrowse list
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10770 if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10771 " call Decho("appendng current buffer to browselist",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10772 call add(s:netrw_browselist,bufnr("%"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10773 " call Decho("browselist=".string(s:netrw_browselist),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10774 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10775
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10776 " enable autocmd events to handle refreshing/removing local browser buffers
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10777 " If local browse buffer is currently showing: refresh it
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10778 " If local browse buffer is currently hidden : wipe it
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10779 " g:netrw_fastbrowse=0 : slow speed, never re-use directory listing
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10780 " =1 : medium speed, re-use directory listing for remote only
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10781 " =2 : fast speed, always re-use directory listing when possible
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10782 if g:netrw_fastbrowse <= 1 && !exists("#ShellCmdPost") && !exists("s:netrw_events")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10783 let s:netrw_events= 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10784 augroup AuNetrwEvent
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10785 au!
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10786 if (has("win32") || has("win95") || has("win64") || has("win16"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10787 " call Decho("installing autocmd: ShellCmdPost",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10788 au ShellCmdPost * call s:LocalBrowseRefresh()
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10789 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10790 " call Decho("installing autocmds: ShellCmdPost FocusGained",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10791 au ShellCmdPost,FocusGained * call s:LocalBrowseRefresh()
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10792 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10793 augroup END
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10794
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10795 " user must have changed fastbrowse to its fast setting, so remove
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10796 " the associated autocmd events
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10797 elseif g:netrw_fastbrowse > 1 && exists("#ShellCmdPost") && exists("s:netrw_events")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10798 " call Decho("remove AuNetrwEvent autcmd group",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10799 unlet s:netrw_events
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10800 augroup AuNetrwEvent
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10801 au!
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10802 augroup END
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10803 augroup! AuNetrwEvent
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10804 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10805
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10806 " call Dret("s:LocalFastBrowser : browselist<".string(s:netrw_browselist).">")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10807 endfun
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10808
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10809 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10810 " s:LocalListing: does the job of "ls" for local directories {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10811 fun! s:LocalListing()
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10812 " call Dfunc("s:LocalListing()")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10813 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10814 " call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10815 " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10816
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10817 " if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist",'~'.expand("<slnum>")) |endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10818 " 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",'~'.expand("<slnum>"))|endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10819 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10820
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10821 " get the list of files contained in the current directory
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10822 let dirname = b:netrw_curdir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10823 let dirnamelen = strlen(b:netrw_curdir)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10824 let filelist = s:NetrwGlob(dirname,"*",0)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10825 let filelist = filelist + s:NetrwGlob(dirname,".*",0)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10826 " call Decho("filelist=".string(filelist),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10827
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10828 if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10829 " call Decho("filelist=".string(filelist),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10830 elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10831 " include ../ in the glob() entry if its missing
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10832 " call Decho("forcibly including on \"..\"",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10833 let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")]
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10834 " call Decho("filelist=".string(filelist),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10835 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10836
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10837 " call Decho("before while: dirname <".dirname.">",'~'.expand("<slnum>"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10838 " call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10839 " call Decho("before while: filelist =".string(filelist),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10840
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10841 if get(g:, 'netrw_dynamic_maxfilenamelen', 0)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10842 let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10843 let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10844 " call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10845 " call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen,'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10846 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10847 " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10848
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10849 for filename in filelist
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10850 " call Decho(" ",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10851 " call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10852 " call DechoBuf(bufnr("%"),"COMBAK#1")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10853
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10854 if getftype(filename) == "link"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10855 " indicate a symbolic link
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10856 " call Decho("indicate <".filename."> is a symbolic link with trailing @",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10857 let pfile= filename."@"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10858
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10859 elseif getftype(filename) == "socket"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10860 " indicate a socket
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10861 " call Decho("indicate <".filename."> is a socket with trailing =",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10862 let pfile= filename."="
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10863
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10864 elseif getftype(filename) == "fifo"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10865 " indicate a fifo
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10866 " call Decho("indicate <".filename."> is a fifo with trailing |",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10867 let pfile= filename."|"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10868
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10869 elseif isdirectory(s:NetrwFile(filename))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10870 " indicate a directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10871 " call Decho("indicate <".filename."> is a directory with trailing /",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10872 let pfile= filename."/"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10873
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10874 elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10875 if (has("win32") || has("win95") || has("win64") || has("win16"))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10876 if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10877 " indicate an executable
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10878 " call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10879 let pfile= filename."*"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10880 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10881 " normal file
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10882 let pfile= filename
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10883 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10884 elseif executable(filename)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10885 " indicate an executable
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10886 " call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10887 let pfile= filename."*"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10888 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10889 " normal file
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10890 let pfile= filename
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10891 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10892
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10893 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10894 " normal file
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10895 let pfile= filename
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10896 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10897 " call Decho("pfile<".pfile."> (after *@/ appending)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10898
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10899 if pfile =~ '//$'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10900 let pfile= substitute(pfile,'//$','/','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10901 " call Decho("change // to /: pfile<".pfile.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10902 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10903 let pfile= strpart(pfile,dirnamelen)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10904 let pfile= substitute(pfile,'^[/\\]','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10905 " call Decho("filename<".filename.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10906 " call Decho("pfile <".pfile.">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10907
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10908 if w:netrw_liststyle == s:LONGLIST
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10909 let sz = getfsize(filename)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10910 if g:netrw_sizestyle =~# "[hH]"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10911 let sz= s:NetrwHumanReadable(sz)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10912 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10913 let fsz = strpart(" ",1,15-strlen(sz)).sz
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10914 let longfile= printf("%-".(g:netrw_maxfilenamelen+1)."s",pfile)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10915 let pfile = longfile.fsz." ".strftime(g:netrw_timefmt,getftime(filename))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10916 " call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10917 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10918
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10919 if g:netrw_sort_by =~# "^t"
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10920 " sort by time (handles time up to 1 quintillion seconds, US)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10921 " call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10922 let t = getftime(filename)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10923 let ft = strpart("000000000000000000",1,18-strlen(t)).t
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10924 " call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10925 let ftpfile= ft.'/'.pfile
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10926 sil! NetrwKeepj put=ftpfile
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10927
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10928 elseif g:netrw_sort_by =~ "^s"
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10929 " sort by size (handles file sizes up to 1 quintillion bytes, US)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10930 " call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10931 let sz = getfsize(filename)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
10932 if g:netrw_sizestyle =~# "[hH]"
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10933 let sz= s:NetrwHumanReadable(sz)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10934 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10935 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10936 " call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10937 let fszpfile= fsz.'/'.pfile
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10938 sil! NetrwKeepj put =fszpfile
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10939
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10940 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10941 " sort by name
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10942 " call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10943 sil! NetrwKeepj put=pfile
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10944 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
10945 " call DechoBuf(bufnr("%"),"COMBAK#2")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10946 endfor
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10947
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10948 " cleanup any windows mess at end-of-line
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10949 sil! NetrwKeepj g/^$/d
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10950 sil! NetrwKeepj %s/\r$//e
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10951 call histdel("/",-1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10952 " call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10953 exe "setl ts=".(g:netrw_maxfilenamelen+1)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10954
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10955 " call Dret("s:LocalListing")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10956 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10957
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
10958 " ---------------------------------------------------------------------
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10959 " s:NetrwLocalExecute: uses system() to execute command under cursor ("X" command support) {{{2
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10960 fun! s:NetrwLocalExecute(cmd)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10961 " call Dfunc("s:NetrwLocalExecute(cmd<".a:cmd.">)")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10962 let ykeep= @@
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10963 " sanity check
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10964 if !executable(a:cmd)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10965 call netrw#ErrorMsg(s:ERROR,"the file<".a:cmd."> is not executable!",89)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10966 let @@= ykeep
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10967 " call Dret("s:NetrwLocalExecute")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10968 return
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10969 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10970
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10971 let optargs= input(":!".a:cmd,"","file")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10972 " call Decho("optargs<".optargs.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10973 let result= system(a:cmd.optargs)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10974 " call Decho("result,'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10975
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10976 " strip any ansi escape sequences off
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10977 let result = substitute(result,"\e\\[[0-9;]*m","","g")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10978
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10979 " show user the result(s)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10980 echomsg result
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10981 let @@= ykeep
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10982
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10983 " call Dret("s:NetrwLocalExecute")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10984 endfun
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10985
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10986 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
10987 " s:NetrwLocalRename: rename a local file or directory {{{2
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10988 fun! s:NetrwLocalRename(path) range
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10989 " call Dfunc("NetrwLocalRename(path<".a:path.">)")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10990
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10991 " preparation for removing multiple files/directories
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10992 let ykeep = @@
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
10993 let ctr = a:firstline
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10994 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
10995 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10996
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10997 " rename files given by the markfilelist
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10998 if exists("s:netrwmarkfilelist_{bufnr('%')}")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
10999 for oldname in s:netrwmarkfilelist_{bufnr("%")}
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11000 " call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11001 if exists("subfrom")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11002 let newname= substitute(oldname,subfrom,subto,'')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11003 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11004 else
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11005 call inputsave()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11006 let newname= input("Moving ".oldname." to : ",oldname,"file")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11007 call inputrestore()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11008 if newname =~ ''
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11009 " two ctrl-x's : ignore all of string preceding the ctrl-x's
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11010 let newname = substitute(newname,'^.*','','')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11011 elseif newname =~ ''
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11012 " one ctrl-x : ignore portion of string preceding ctrl-x but after last /
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11013 let newname = substitute(newname,'[^/]*','','')
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11014 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11015 if newname =~ '^s/'
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11016 let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','')
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11017 let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11018 " call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11019 let newname = substitute(oldname,subfrom,subto,'')
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11020 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11021 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11022 call rename(oldname,newname)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11023 endfor
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11024 call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11025
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11026 else
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11027
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11028 " attempt to rename files/directories
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11029 while ctr <= a:lastline
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11030 exe "NetrwKeepj ".ctr
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11031
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11032 " sanity checks
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11033 if line(".") < w:netrw_bannercnt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11034 let ctr= ctr + 1
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11035 continue
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11036 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11037 let curword= s:NetrwGetWord()
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11038 if curword == "./" || curword == "../"
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11039 let ctr= ctr + 1
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11040 continue
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11041 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11042
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11043 NetrwKeepj norm! 0
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11044 let oldname= s:ComposePath(a:path,curword)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11045 " call Decho("oldname<".oldname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11046
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11047 call inputsave()
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11048 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11049 call inputrestore()
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11050
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11051 call rename(oldname,newname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11052 " call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11053
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11054 let ctr= ctr + 1
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11055 endwhile
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11056 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11057
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11058 " refresh the directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11059 " call Decho("refresh the directory listing",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11060 NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11061 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11062 NetrwKeepj call winrestview(svpos)
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11063 let @@= ykeep
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11064
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11065 " call Dret("NetrwLocalRename")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11066 endfun
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11067
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11068 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11069 " s:NetrwLocalRm: {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11070 fun! s:NetrwLocalRm(path) range
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11071 " call Dfunc("s:NetrwLocalRm(path<".a:path.">)")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11072 " call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11073
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11074 " preparation for removing multiple files/directories
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11075 let ykeep = @@
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11076 let ret = 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11077 let all = 0
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11078 let svpos = winsaveview()
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11079 " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11080
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11081 if exists("s:netrwmarkfilelist_{bufnr('%')}")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11082 " remove all marked files
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11083 " call Decho("remove all marked files",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11084 for fname in s:netrwmarkfilelist_{bufnr("%")}
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11085 let ok= s:NetrwLocalRmFile(a:path,fname,all)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11086 if ok =~# 'q\%[uit]' || ok == "no"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11087 break
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11088 elseif ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11089 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11090 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11091 endfor
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11092 call s:NetrwUnMarkFile(1)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11093
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11094 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11095 " remove (multiple) files and directories
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11096 " call Decho("remove files in range [".a:firstline.",".a:lastline."]",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11097
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11098 let keepsol= &l:sol
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11099 setl nosol
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11100 let ctr = a:firstline
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11101 while ctr <= a:lastline
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11102 exe "NetrwKeepj ".ctr
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11103
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11104 " sanity checks
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11105 if line(".") < w:netrw_bannercnt
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11106 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11107 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11108 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11109 let curword= s:NetrwGetWord()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11110 if curword == "./" || curword == "../"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11111 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11112 continue
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11113 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11114 let ok= s:NetrwLocalRmFile(a:path,curword,all)
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11115 if ok =~# 'q\%[uit]' || ok == "no"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11116 break
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11117 elseif ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11118 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11119 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11120 let ctr= ctr + 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11121 endwhile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11122 let &l:sol= keepsol
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11123 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11124
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11125 " refresh the directory
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11126 " call Decho("bufname<".bufname("%").">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11127 if bufname("%") != "NetrwMessage"
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11128 NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./'))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11129 " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11130 NetrwKeepj call winrestview(svpos)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11131 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
11132 let @@= ykeep
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11133
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11134 " call Dret("s:NetrwLocalRm")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11135 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11136
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11137 " ---------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11138 " s:NetrwLocalRmFile: remove file fname given the path {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11139 " Give confirmation prompt unless all==1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11140 fun! s:NetrwLocalRmFile(path,fname,all)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11141 " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11142
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11143 let all= a:all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11144 let ok = ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11145 NetrwKeepj norm! 0
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11146 let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11147 " call Decho("rmfile<".rmfile.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11148
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11149 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11150 " attempt to remove file
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11151 " call Decho("attempt to remove file<".rmfile.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11152 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11153 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11154 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11155 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
11156 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11157 echohl NONE
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11158 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11159 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11160 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11161 " call Decho("response: ok<".ok.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11162 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11163 " call Decho("response: ok<".ok."> (after sub)",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11164 if ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11165 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11166 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11167 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11168
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11169 if all || ok =~# 'y\%[es]' || ok == ""
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11170 let ret= s:NetrwDelete(rmfile)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11171 " call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11172 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11173
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11174 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11175 " attempt to remove directory
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11176 if !all
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11177 echohl Statement
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11178 call inputsave()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11179 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
11180 call inputrestore()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11181 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
11182 if ok == ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11183 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11184 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11185 if ok =~# 'a\%[ll]'
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11186 let all= 1
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11187 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11188 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11189 let rmfile= substitute(rmfile,'[\/]$','','e')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11190
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11191 if all || ok =~# 'y\%[es]' || ok == ""
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11192 if v:version < 704 || (v:version == 704 && !has("patch1107"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11193 " " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11194 call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11195 " " call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11196
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11197 if v:shell_error != 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11198 " " call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11199 let errcode= s:NetrwDelete(rmfile)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11200 " " call Decho("errcode=".errcode,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11201
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11202 if errcode != 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11203 if has("unix")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11204 " " call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11205 call system("rm ".s:ShellEscape(rmfile))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11206 if v:shell_error != 0 && !exists("g:netrw_quiet")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11207 call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11208 let ok="no"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11209 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11210 elseif !exists("g:netrw_quiet")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11211 call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",35)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11212 let ok="no"
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11213 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11214 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11215 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11216 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11217 if delete(rmfile,"d")
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11218 call netrw#ErrorMsg(s:ERROR,"unable to delete directory <".rmfile.">!",103)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11219 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11220 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11221 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11222 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11223
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11224 " call Dret("s:NetrwLocalRmFile ".ok)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11225 return ok
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11226 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11227
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11228 " =====================================================================
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11229 " Support Functions: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11230
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11231 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11232 " netrw#Access: intended to provide access to variable values for netrw's test suite {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11233 " 0: marked file list of current buffer
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11234 " 1: marked file target
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11235 fun! netrw#Access(ilist)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11236 if a:ilist == 0
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11237 if exists("s:netrwmarkfilelist_".bufnr('%'))
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11238 return s:netrwmarkfilelist_{bufnr('%')}
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11239 else
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11240 return "no-list-buf#".bufnr('%')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11241 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11242 elseif a:ilist == 1
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11243 return s:netrwmftgt
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11244 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11245 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11246
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11247 " ---------------------------------------------------------------------
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11248 " netrw#Call: allows user-specified mappings to call internal netrw functions {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11249 fun! netrw#Call(funcname,...)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11250 return call("s:".a:funcname,a:000)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11251 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11252
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11253 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11254 " netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11255 " I expect this function to be used in
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11256 " :PChkAssert netrw#Expose("netrwmarkfilelist")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11257 " for example.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11258 fun! netrw#Expose(varname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11259 " call Dfunc("netrw#Expose(varname<".a:varname.">)")
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11260 if exists("s:".a:varname)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11261 exe "let retval= s:".a:varname
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11262 if exists("g:netrw_pchk")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11263 if type(retval) == 3
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11264 let retval = copy(retval)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11265 let i = 0
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11266 while i < len(retval)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11267 let retval[i]= substitute(retval[i],expand("$HOME"),'~','')
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11268 let i = i + 1
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11269 endwhile
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11270 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11271 " call Dret("netrw#Expose ".string(retval))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11272 return string(retval)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11273 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11274 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11275 let retval= "n/a"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11276 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11277
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11278 " call Dret("netrw#Expose ".string(retval))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11279 return retval
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11280 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11281
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11282 " ---------------------------------------------------------------------
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11283 " netrw#Modify: allows UserMaps to set (modify) script-local variables {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11284 fun! netrw#Modify(varname,newvalue)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11285 " call Dfunc("netrw#Modify(varname<".a:varname.">,newvalue<".string(a:newvalue).">)")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11286 exe "let s:".a:varname."= ".string(a:newvalue)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11287 " call Dret("netrw#Modify")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11288 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11289
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11290 " ---------------------------------------------------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11291 " netrw#RFC2396: converts %xx into characters {{{2
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11292 fun! netrw#RFC2396(fname)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11293 " call Dfunc("netrw#RFC2396(fname<".a:fname.">)")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11294 let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11295 " call Dret("netrw#RFC2396 ".fname)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11296 return fname
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11297 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11298
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11299 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11300 " netrw#UserMaps: supports user-specified maps {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11301 " see :help function()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11302 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11303 " g:Netrw_UserMaps is a List with members such as:
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11304 " [[keymap sequence, function reference],...]
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11305 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11306 " The referenced function may return a string,
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11307 " refresh : refresh the display
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11308 " -other- : this string will be executed
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11309 " or it may return a List of strings.
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11310 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11311 " Each keymap-sequence will be set up with a nnoremap
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11312 " to invoke netrw#UserMaps(a:islocal).
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11313 " Related functions:
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11314 " netrw#Expose(varname) -- see s:varname variables
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11315 " netrw#Modify(varname,newvalue) -- modify value of s:varname variable
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11316 " netrw#Call(funcname,...) -- call internal netrw function with optional arguments
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11317 fun! netrw#UserMaps(islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11318 " call Dfunc("netrw#UserMaps(islocal=".a:islocal.")")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11319 " call Decho("g:Netrw_UserMaps ".(exists("g:Netrw_UserMaps")? "exists" : "does NOT exist"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11320
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11321 " set up usermaplist
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11322 if exists("g:Netrw_UserMaps") && type(g:Netrw_UserMaps) == 3
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11323 " call Decho("g:Netrw_UserMaps has type 3<List>",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11324 for umap in g:Netrw_UserMaps
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11325 " call Decho("type(umap[0]<".string(umap[0]).">)=".type(umap[0])." (should be 1=string)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11326 " call Decho("type(umap[1])=".type(umap[1])." (should be 1=string)",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11327 " if umap[0] is a string and umap[1] is a string holding a function name
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11328 if type(umap[0]) == 1 && type(umap[1]) == 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11329 " call Decho("nno <buffer> <silent> ".umap[0]." :call s:UserMaps(".a:islocal.",".string(umap[1]).")<cr>",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11330 exe "nno <buffer> <silent> ".umap[0]." :call <SID>UserMaps(".a:islocal.",'".umap[1]."')<cr>"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11331 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11332 call netrw#ErrorMsg(s:WARNING,"ignoring usermap <".string(umap[0])."> -- not a [string,funcref] entry",99)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11333 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11334 endfor
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11335 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11336 " call Dret("netrw#UserMaps")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11337 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11338
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11339 " ---------------------------------------------------------------------
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11340 " netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11341 fun! netrw#WinPath(path)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11342 " call Dfunc("netrw#WinPath(path<".a:path.">)")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11343 if (!g:netrw_cygwin || &shell !~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16"))
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11344 " remove cygdrive prefix, if present
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11345 let path = substitute(a:path,g:netrw_cygdrive.'/\(.\)','\1:','')
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11346 " remove trailing slash (Win95)
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11347 let path = substitute(path, '\(\\\|/\)$', '', 'g')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11348 " remove escaped spaces
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11349 let path = substitute(path, '\ ', ' ', 'g')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11350 " convert slashes to backslashes
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11351 let path = substitute(path, '/', '\', 'g')
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11352 else
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11353 let path= a:path
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11354 endif
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11355 " call Dret("netrw#WinPath <".path.">")
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11356 return path
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11357 endfun
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11358
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
11359 " ---------------------------------------------------------------------
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11360 " s:NetrwBadd: adds marked files to buffer list or vice versa {{{2
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11361 " cb : bl2mf=0 add marked files to buffer list
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11362 " cB : bl2mf=1 use bufferlist to mark files
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11363 " (mnemonic: cb = copy (marked files) to buffer list)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11364 fun! s:NetrwBadd(islocal,bl2mf)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11365 " " call Dfunc("s:NetrwBadd(islocal=".a:islocal." mf2bl=".mf2bl.")")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11366 if a:bl2mf
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11367 " cB: add buffer list to marked files
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11368 redir => bufl
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11369 ls
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11370 redir END
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11371 let bufl = map(split(bufl,"\n"),'substitute(v:val,''^.\{-}"\(.*\)".\{-}$'',''\1'','''')')
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11372 for fname in bufl
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11373 call s:NetrwMarkFile(a:islocal,fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11374 endfor
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11375 else
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11376 " cb: add marked files to buffer list
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11377 for fname in s:netrwmarkfilelist_{bufnr("%")}
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11378 " " call Decho("badd ".fname,'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11379 exe "badd ".fnameescape(fname)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11380 endfor
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11381 let curbufnr = bufnr("%")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11382 let curdir = s:NetrwGetCurdir(a:islocal)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11383 call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11384 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11385 " call Dret("s:NetrwBadd")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11386 endfun
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11387
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11388 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11389 " 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
11390 fun! s:ComposePath(base,subdir)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11391 " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11392
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11393 if has("amiga")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11394 " call Decho("amiga",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11395 let ec = a:base[s:Strlen(a:base)-1]
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11396 if ec != '/' && ec != ':'
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11397 let ret = a:base."/" . a:subdir
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11398 else
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11399 let ret = a:base.a:subdir
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11400 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11401
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11402 " COMBAK: test on windows with changing to root directory: :e C:/
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11403 elseif a:subdir =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11404 " call Decho("windows",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11405 let ret= a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11406
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11407 elseif a:base =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11408 " call Decho("windows",'~'.expand("<slnum>"))
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11409 if a:base =~ '[/\\]$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11410 let ret= a:base.a:subdir
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11411 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11412 let ret= a:base.'/'.a:subdir
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11413 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11414
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11415 elseif a:base =~ '^\a\{3,}://'
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11416 " call Decho("remote linux/macos",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11417 let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11418 let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11419 if a:subdir == '../'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11420 if curpath =~ '[^/]/[^/]\+/$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11421 let curpath= substitute(curpath,'[^/]\+/$','','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11422 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11423 let curpath=""
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11424 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11425 let ret= urlbase.curpath
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11426 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11427 let ret= urlbase.curpath.a:subdir
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11428 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11429 " call Decho("urlbase<".urlbase.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11430 " call Decho("curpath<".curpath.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11431 " call Decho("ret<".ret.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11432
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11433 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11434 " call Decho("local linux/macos",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11435 let ret = substitute(a:base."/".a:subdir,"//","/","g")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11436 if a:base =~ '^//'
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11437 " keeping initial '//' for the benefit of network share listing support
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11438 let ret= '/'.ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11439 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11440 let ret= simplify(ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11441 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11442
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11443 " call Dret("s:ComposePath ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11444 return ret
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11445 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11446
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11447 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11448 " s:DeleteBookmark: deletes a file/directory from Netrw's bookmark system {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11449 " Related Functions: s:MakeBookmark() s:NetrwBookHistHandler() s:NetrwBookmark()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11450 fun! s:DeleteBookmark(fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11451 " call Dfunc("s:DeleteBookmark(fname<".a:fname.">)")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11452 call s:MergeBookmarks()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11453
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11454 if exists("g:netrw_bookmarklist")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11455 let indx= index(g:netrw_bookmarklist,a:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11456 if indx == -1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11457 let indx= 0
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11458 while indx < len(g:netrw_bookmarklist)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11459 if g:netrw_bookmarklist[indx] =~ a:fname
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11460 call remove(g:netrw_bookmarklist,indx)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11461 let indx= indx - 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11462 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11463 let indx= indx + 1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11464 endwhile
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11465 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11466 " remove exact match
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11467 call remove(g:netrw_bookmarklist,indx)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11468 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11469 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11470
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11471 " call Dret("s:DeleteBookmark")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11472 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11473
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11474 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11475 " s:FileReadable: o/s independent filereadable {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11476 fun! s:FileReadable(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11477 " call Dfunc("s:FileReadable(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11478
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11479 if g:netrw_cygwin
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11480 let ret= filereadable(s:NetrwFile(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/','')))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11481 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11482 let ret= filereadable(s:NetrwFile(a:fname))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11483 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11484
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11485 " call Dret("s:FileReadable ".ret)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11486 return ret
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11487 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11488
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11489 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11490 " 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
11491 " Places correct suffix on end of temporary filename,
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11492 " using the suffix provided with fname
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11493 fun! s:GetTempfile(fname)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11494 " call Dfunc("s:GetTempfile(fname<".a:fname.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11495
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11496 if !exists("b:netrw_tmpfile")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11497 " get a brand new temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11498 let tmpfile= tempname()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11499 " call Decho("tmpfile<".tmpfile."> : from tempname()",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11500
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11501 let tmpfile= substitute(tmpfile,'\','/','ge')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11502 " call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11503
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11504 " sanity check -- does the temporary file's directory exist?
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11505 if !isdirectory(s:NetrwFile(substitute(tmpfile,'[^/]\+$','','e')))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11506 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11507 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11508 " call Dret("s:GetTempfile getcwd<".getcwd().">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11509 return ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11510 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11511
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11512 " let netrw#NetSource() know about the tmpfile
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11513 let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11514 " call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">",'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11515
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11516 " o/s dependencies
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11517 if g:netrw_cygwin != 0
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11518 let tmpfile = substitute(tmpfile,'^\(\a\):',g:netrw_cygdrive.'/\1','e')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11519 elseif has("win32") || has("win95") || has("win64") || has("win16")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11520 if !exists("+shellslash") || !&ssl
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11521 let tmpfile = substitute(tmpfile,'/','\','g')
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11522 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11523 else
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11524 let tmpfile = tmpfile
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11525 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11526 let b:netrw_tmpfile= tmpfile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11527 " call Decho("o/s dependent fixed tempname<".tmpfile.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11528 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11529 " re-use temporary filename
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11530 let tmpfile= b:netrw_tmpfile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11531 " call Decho("tmpfile<".tmpfile."> re-using",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11532 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11533
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11534 " use fname's suffix for the temporary file
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11535 if a:fname != ""
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11536 if a:fname =~ '\.[^./]\+$'
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11537 " call Decho("using fname<".a:fname.">'s suffix",'~'.expand("<slnum>"))
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
11538 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
11539 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
11540 elseif a:fname =~ '.txz$'
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
11541 let suffix = ".txz".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11542 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11543 let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11544 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11545 " call Decho("suffix<".suffix.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11546 let tmpfile= substitute(tmpfile,'\.tmp$','','e')
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11547 " call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11548 let tmpfile .= suffix
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11549 " call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11550 let s:netrw_tmpfile= tmpfile " supports netrw#NetSource()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11551 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11552 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11553
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11554 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11555 " call Dret("s:GetTempfile <".tmpfile.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11556 return tmpfile
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11557 endfun
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11558
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11559 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11560 " s:MakeSshCmd: transforms input command using USEPORT HOSTNAME into {{{2
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11561 " a correct command for use with a system() call
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11562 fun! s:MakeSshCmd(sshcmd)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11563 " call Dfunc("s:MakeSshCmd(sshcmd<".a:sshcmd.">) user<".s:user."> machine<".s:machine.">")
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11564 if s:user == ""
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11565 let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:machine,'')
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11566 else
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11567 let sshcmd = substitute(a:sshcmd,'\<HOSTNAME\>',s:user."@".s:machine,'')
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11568 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11569 if exists("g:netrw_port") && g:netrw_port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
11570 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.g:netrw_port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11571 elseif exists("s:port") && s:port != ""
1209
070f2ac50cf8 updated for version 7.1b
vimboss
parents: 1121
diff changeset
11572 let sshcmd= substitute(sshcmd,"USEPORT",g:netrw_sshport.' '.s:port,'')
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11573 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11574 let sshcmd= substitute(sshcmd,"USEPORT ",'','')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11575 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11576 " call Dret("s:MakeSshCmd <".sshcmd.">")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11577 return sshcmd
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11578 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11579
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
11580 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11581 " s:MakeBookmark: enters a bookmark into Netrw's bookmark system {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11582 fun! s:MakeBookmark(fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11583 " call Dfunc("s:MakeBookmark(fname<".a:fname.">)")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11584
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11585 if !exists("g:netrw_bookmarklist")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11586 let g:netrw_bookmarklist= []
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11587 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11588
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11589 if index(g:netrw_bookmarklist,a:fname) == -1
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11590 " curdir not currently in g:netrw_bookmarklist, so include it
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11591 if isdirectory(s:NetrwFile(a:fname)) && a:fname !~ '/$'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11592 call add(g:netrw_bookmarklist,a:fname.'/')
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11593 elseif a:fname !~ '/'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11594 call add(g:netrw_bookmarklist,getcwd()."/".a:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11595 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11596 call add(g:netrw_bookmarklist,a:fname)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11597 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11598 call sort(g:netrw_bookmarklist)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11599 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11600
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11601 " call Dret("s:MakeBookmark")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11602 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11603
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11604 " ---------------------------------------------------------------------
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11605 " s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11606 fun! s:MergeBookmarks()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11607 " call Dfunc("s:MergeBookmarks() : merge current bookmarks into .netrwbook")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11608 " get bookmarks from .netrwbook file
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11609 let savefile= s:NetrwHome()."/.netrwbook"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11610 if filereadable(s:NetrwFile(savefile))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11611 " call Decho("merge bookmarks (active and file)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11612 NetrwKeepj call s:NetrwBookHistSave()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11613 " call Decho("bookmark delete savefile<".savefile.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11614 NetrwKeepj call delete(savefile)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11615 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11616 " call Dret("s:MergeBookmarks")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11617 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11618
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11619 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11620 " s:NetrwBMShow: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11621 fun! s:NetrwBMShow()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11622 " call Dfunc("s:NetrwBMShow()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11623 redir => bmshowraw
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11624 menu
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11625 redir END
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11626 let bmshowlist = split(bmshowraw,'\n')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11627 if bmshowlist != []
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11628 let bmshowfuncs= filter(bmshowlist,'v:val =~# "<SNR>\\d\\+_BMShow()"')
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11629 if bmshowfuncs != []
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11630 let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','')
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11631 if bmshowfunc =~# '^call.*BMShow()'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11632 exe "sil! NetrwKeepj ".bmshowfunc
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11633 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11634 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11635 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11636 " call Dret("s:NetrwBMShow : bmshowfunc<".(exists("bmshowfunc")? bmshowfunc : 'n/a').">")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11637 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11638
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11639 " ---------------------------------------------------------------------
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11640 " s:NetrwCursor: responsible for setting cursorline/cursorcolumn based upon g:netrw_cursor {{{2
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11641 fun! s:NetrwCursor()
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11642 if !exists("w:netrw_liststyle")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11643 let w:netrw_liststyle= g:netrw_liststyle
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11644 endif
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11645 " call Dfunc("s:NetrwCursor() ft<".&ft."> liststyle=".w:netrw_liststyle." g:netrw_cursor=".g:netrw_cursor." s:netrw_usercuc=".s:netrw_usercuc." s:netrw_usercul=".s:netrw_usercul)
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11646
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11647 if &ft != "netrw"
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11648 " if the current window isn't a netrw directory listing window, then use user cursorline/column
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11649 " settings. Affects when netrw is used to read/write a file using scp/ftp/etc.
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11650 " call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11651 let &l:cursorline = s:netrw_usercul
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11652 let &l:cursorcolumn = s:netrw_usercuc
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11653
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11654 elseif g:netrw_cursor == 4
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11655 " all styles: cursorline, cursorcolumn
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11656 " call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11657 setl cursorline
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11658 setl cursorcolumn
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11659
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11660 elseif g:netrw_cursor == 3
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11661 " thin-long-tree: cursorline, user's cursorcolumn
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11662 " wide : cursorline, cursorcolumn
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11663 if w:netrw_liststyle == s:WIDELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11664 " call Decho("case g:netrw_cursor==3 and wide: setl cul cuc",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11665 setl cursorline
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11666 setl cursorcolumn
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11667 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11668 " call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("<slnum>"))
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11669 setl cursorline
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11670 let &l:cursorcolumn = s:netrw_usercuc
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11671 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11672
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11673 elseif g:netrw_cursor == 2
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11674 " thin-long-tree: cursorline, user's cursorcolumn
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11675 " wide : cursorline, user's cursorcolumn
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11676 " call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11677 let &l:cursorcolumn = s:netrw_usercuc
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
11678 setl cursorline
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11679
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11680 elseif g:netrw_cursor == 1
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11681 " thin-long-tree: user's cursorline, user's cursorcolumn
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11682 " wide : cursorline, user's cursorcolumn
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11683 let &l:cursorcolumn = s:netrw_usercuc
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11684 if w:netrw_liststyle == s:WIDELIST
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11685 " call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("<slnum>"))
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11686 setl cursorline
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11687 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11688 " call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11689 let &l:cursorline = s:netrw_usercul
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11690 endif
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11691
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11692 else
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11693 " all styles: user's cursorline, user's cursorcolumn
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11694 " call Decho("default: (use user's cul,cuc)",'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11695 let &l:cursorline = s:netrw_usercul
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11696 let &l:cursorcolumn = s:netrw_usercuc
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11697 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11698
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11699 " call Dret("s:NetrwCursor : l:cursorline=".&l:cursorline." l:cursorcolumn=".&l:cursorcolumn)
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11700 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11701
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11702 " ---------------------------------------------------------------------
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11703 " s:RestoreCursorline: restores cursorline/cursorcolumn to original user settings {{{2
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11704 fun! s:RestoreCursorline()
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11705 " call Dfunc("s:RestoreCursorline() currently, cul=".&l:cursorline." cuc=".&l:cursorcolumn." win#".winnr()." buf#".bufnr("%"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11706 if exists("s:netrw_usercul")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11707 let &l:cursorline = s:netrw_usercul
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11708 endif
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11709 if exists("s:netrw_usercuc")
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11710 let &l:cursorcolumn = s:netrw_usercuc
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11711 endif
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11712 " call Dret("s:RestoreCursorline : restored cul=".&l:cursorline." cuc=".&l:cursorcolumn)
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11713 endfun
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11714
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 2120
diff changeset
11715 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11716 " s:NetrwDelete: Deletes a file. {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11717 " Uses Steve Hall's idea to insure that Windows paths stay
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11718 " acceptable. No effect on Unix paths.
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11719 " Examples of use: let result= s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11720 fun! s:NetrwDelete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11721 " call Dfunc("s:NetrwDelete(path<".a:path.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11722
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11723 let path = netrw#WinPath(a:path)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11724 if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16"))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11725 if exists("+shellslash")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11726 let sskeep= &shellslash
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
11727 setl noshellslash
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11728 let result = delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11729 let &shellslash = sskeep
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11730 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11731 " call Decho("exe let result= ".a:cmd."('".path."')",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11732 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11733 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11734 else
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11735 " call Decho("let result= delete(".path.")",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11736 let result= delete(path)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11737 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11738 if result < 0
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11739 NetrwKeepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11740 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11741
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11742 " call Dret("s:NetrwDelete ".result)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11743 return result
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11744 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11745
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11746 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11747 " 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
11748 fun! s:NetrwEnew(...)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11749 " call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")." expand(%)<".expand("%").">")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11750 " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11751
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11752 " grab a function-local-variable copy of buffer variables
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11753 " call Decho("make function-local copy of netrw variables",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11754 if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11755 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
11756 if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11757 if exists("b:netrw_curdir") |let netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11758 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
11759 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
11760 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
11761 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
11762 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
11763 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
11764 if exists("b:netrw_fname") |let netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11765 if exists("b:netrw_lastfile") |let netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11766 if exists("b:netrw_liststyle") |let netrw_liststyle = b:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11767 if exists("b:netrw_method") |let netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11768 if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11769 if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11770
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11771 NetrwKeepj call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11772 " call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11773 " when tree listing uses file TreeListing... a new buffer is made.
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11774 " Want the old buffer to be unlisted.
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11775 " COMBAK: this causes a problem, see P43
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11776 " setl nobl
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
11777 let netrw_keepdiff= &l:diff
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11778 noswapfile NetrwKeepj keepalt enew!
2420
6de9efd58dc0 Updated runtime files. New netrw plugin version.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
11779 let &l:diff= netrw_keepdiff
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11780 " call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("<slnum>"))
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11781 NetrwKeepj call s:NetrwOptionsSave("w:")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11782
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11783 " copy function-local-variables to buffer variable equivalents
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11784 " call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11785 if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11786 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
11787 if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11788 if exists("netrw_curdir") |let b:netrw_curdir = netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11789 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
11790 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
11791 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
11792 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
11793 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
11794 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
11795 if exists("netrw_fname") |let b:netrw_fname = netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11796 if exists("netrw_lastfile") |let b:netrw_lastfile = netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11797 if exists("netrw_liststyle") |let b:netrw_liststyle = netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11798 if exists("netrw_method") |let b:netrw_method = netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11799 if exists("netrw_option") |let b:netrw_option = netrw_option |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11800 if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11801
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11802 if a:0 > 0
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11803 let b:netrw_curdir= a:1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11804 if b:netrw_curdir =~ '/$'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11805 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11806 setl nobl
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11807 file NetrwTreeListing
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11808 setl nobl bt=nowrite bh=hide
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11809 nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr>
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11810 nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr>
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11811 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11812 call s:NetrwBufRename(b:netrw_curdir)
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
11813 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11814 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11815 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11816
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11817 " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11818 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11819
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11820 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11821 " s:NetrwExe: executes a string using "!" {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11822 fun! s:NetrwExe(cmd)
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11823 " call Dfunc("s:NetrwExe(a:cmd<".a:cmd.">)")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11824 if has("win32") && &shell !~? 'cmd' && !g:netrw_cygwin
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11825 " call Decho("using win32:",expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11826 let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash]
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11827 set shell& shellcmdflag& shellxquote& shellxescape&
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11828 set shellquote& shellpipe& shellredir& shellslash&
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11829 exe a:cmd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11830 let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11831 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11832 " call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11833 exe a:cmd
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11834 endif
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11835 " call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11836 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11837
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11838 " ---------------------------------------------------------------------
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11839 " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11840 fun! s:NetrwInsureWinVars()
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11841 if !exists("w:netrw_liststyle")
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11842 " call Dfunc("s:NetrwInsureWinVars() win#".winnr())
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11843 let curbuf = bufnr("%")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11844 let curwin = winnr()
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11845 let iwin = 1
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11846 while iwin <= winnr("$")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11847 exe iwin."wincmd w"
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11848 if winnr() != curwin && bufnr("%") == curbuf && exists("w:netrw_liststyle")
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11849 " looks like ctrl-w_s or ctrl-w_v was used to split a netrw buffer
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11850 let winvars= w:
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11851 break
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11852 endif
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11853 let iwin= iwin + 1
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11854 endwhile
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
11855 exe "keepalt ".curwin."wincmd w"
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11856 if exists("winvars")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11857 " call Decho("copying w#".iwin." window variables to w#".curwin,'~'.expand("<slnum>"))
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11858 for k in keys(winvars)
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11859 let w:{k}= winvars[k]
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11860 endfor
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11861 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11862 " call Dret("s:NetrwInsureWinVars win#".winnr())
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
11863 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11864 endfun
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
11865
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11866 " ---------------------------------------------------------------------
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11867 " s:NetrwLcd: handles changing the (local) directory {{{2
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11868 " Returns: 0=success
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11869 " -1=failed
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11870 fun! s:NetrwLcd(newdir)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11871 " call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11872
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11873 let err472= 0
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11874 try
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11875 exe 'NetrwKeepj sil lcd '.fnameescape(a:newdir)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11876 catch /^Vim\%((\a\+)\)\=:E344/
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11877 " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11878 " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11879 " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11880 " forward slashes ('//Foo'), depending on whether backslashes have been converted to
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11881 " forward slashes by earlier code; so check for both.
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11882 if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11883 if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11884 let dirname = '\'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
11885 exe 'NetrwKeepj sil lcd '.fnameescape(dirname)
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11886 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11887 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11888 catch /^Vim\%((\a\+)\)\=:E472/
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11889 let err472= 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11890 endtry
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11891
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11892 if err472
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11893 call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".a:newdir."> (permissions?)",61)
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11894 if exists("w:netrw_prvdir")
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11895 let a:newdir= w:netrw_prvdir
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11896 else
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11897 call s:NetrwOptionsRestore("w:")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11898 " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>"))
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
11899 exe "setl ".g:netrw_bufsettings
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
11900 " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11901 let a:newdir= dirname
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11902 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11903 " call Dret("s:NetrwBrowse -1 : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11904 return -1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11905 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11906
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11907 " call Dret("s:NetrwLcd 0")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
11908 return 0
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11909 endfun
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11910
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11911 " ------------------------------------------------------------------------
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11912 " s:NetrwSaveWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11913 " changed sorting, etc. Also see s:NetrwRestoreWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11914 fun! s:NetrwSaveWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11915 " call Dfunc("NetrwSaveWordPosn()")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11916 let s:netrw_saveword= '^'.fnameescape(getline('.')).'$'
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11917 " call Dret("NetrwSaveWordPosn : saveword<".s:netrw_saveword.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11918 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11919
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11920 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11921 " s:NetrwHumanReadable: takes a number and makes it "human readable" {{{2
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11922 " 1000 -> 1K, 1000000 -> 1M, 1000000000 -> 1G
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11923 fun! s:NetrwHumanReadable(sz)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11924 " call Dfunc("s:NetrwHumanReadable(sz=".a:sz.") type=".type(a:sz)." style=".g:netrw_sizestyle )
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11925
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11926 if g:netrw_sizestyle == 'h'
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11927 if a:sz >= 1000000000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11928 let sz = printf("%.1f",a:sz/1000000000.0)."g"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11929 elseif a:sz >= 10000000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11930 let sz = printf("%d",a:sz/1000000)."m"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11931 elseif a:sz >= 1000000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11932 let sz = printf("%.1f",a:sz/1000000.0)."m"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11933 elseif a:sz >= 10000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11934 let sz = printf("%d",a:sz/1000)."k"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11935 elseif a:sz >= 1000
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11936 let sz = printf("%.1f",a:sz/1000.0)."k"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11937 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11938 let sz= a:sz
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11939 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11940
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11941 elseif g:netrw_sizestyle == 'H'
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11942 if a:sz >= 1073741824
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11943 let sz = printf("%.1f",a:sz/1073741824.0)."G"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11944 elseif a:sz >= 10485760
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11945 let sz = printf("%d",a:sz/1048576)."M"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11946 elseif a:sz >= 1048576
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11947 let sz = printf("%.1f",a:sz/1048576.0)."M"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11948 elseif a:sz >= 10240
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11949 let sz = printf("%d",a:sz/1024)."K"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11950 elseif a:sz >= 1024
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11951 let sz = printf("%.1f",a:sz/1024.0)."K"
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11952 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11953 let sz= a:sz
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11954 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11955
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11956 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11957 let sz= a:sz
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11958 endif
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11959
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11960 " call Dret("s:NetrwHumanReadable ".sz)
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11961 return sz
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11962 endfun
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11963
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
11964 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11965 " s:NetrwRestoreWordPosn: used to keep cursor on same word after refresh, {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11966 " changed sorting, etc. Also see s:NetrwSaveWordPosn().
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11967 fun! s:NetrwRestoreWordPosn()
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11968 " call Dfunc("NetrwRestoreWordPosn()")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
11969 sil! call search(s:netrw_saveword,'w')
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11970 " call Dret("NetrwRestoreWordPosn")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11971 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11972
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
11973 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11974 " s:RestoreBufVars: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11975 fun! s:RestoreBufVars()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11976 " call Dfunc("s:RestoreBufVars()")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11977
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11978 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
11979 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
11980 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
11981 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
11982 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
11983 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
11984
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11985 " call Dret("s:RestoreBufVars")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11986 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11987
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
11988 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11989 " s:RemotePathAnalysis: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11990 fun! s:RemotePathAnalysis(dirname)
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2751
diff changeset
11991 " call Dfunc("s:RemotePathAnalysis(a:dirname<".a:dirname.">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11992
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
11993 " method :// user @ machine :port /path
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11994 let dirpat = '^\(\w\{-}\)://\(\(\w\+\)@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
11995 let s:method = substitute(a:dirname,dirpat,'\1','')
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11996 let s:user = substitute(a:dirname,dirpat,'\3','')
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11997 let s:machine = substitute(a:dirname,dirpat,'\4','')
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11998 let s:port = substitute(a:dirname,dirpat,'\5','')
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
11999 let s:path = substitute(a:dirname,dirpat,'\6','')
5929
16d26051085a Runtime file updates.
Bram Moolenaar <bram@vim.org>
parents: 5734
diff changeset
12000 let s:fname = substitute(s:path,'^.*/\ze.','','')
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12001 if s:machine =~ '@'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12002 let dirpat = '^\(.*\)@\(.\{-}\)$'
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12003 let s:user = s:user.'@'.substitute(s:machine,dirpat,'\1','')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12004 let s:machine = substitute(s:machine,dirpat,'\2','')
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12005 endif
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12006
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12007 " call Decho("set up s:method <".s:method .">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12008 " call Decho("set up s:user <".s:user .">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12009 " call Decho("set up s:machine<".s:machine.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12010 " call Decho("set up s:port <".s:port.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12011 " call Decho("set up s:path <".s:path .">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12012 " call Decho("set up s:fname <".s:fname .">",'~'.expand("<slnum>"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12013
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12014 " call Dret("s:RemotePathAnalysis")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12015 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12016
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12017 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12018 " s:RemoteSystem: runs a command on a remote host using ssh {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12019 " Returns status
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12020 " Runs system() on
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12021 " [cd REMOTEDIRPATH;] a:cmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12022 " Note that it doesn't do s:ShellEscape(a:cmd)!
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12023 fun! s:RemoteSystem(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12024 " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12025 if !executable(g:netrw_ssh_cmd)
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12026 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12027 elseif !exists("b:netrw_curdir")
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12028 NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12029 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12030 let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12031 let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','')
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12032 if remotedir != ""
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12033 let cmd= cmd.' cd '.s:ShellEscape(remotedir).";"
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12034 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12035 let cmd= cmd.' '
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12036 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12037 let cmd= cmd.a:cmd
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12038 " call Decho("call system(".cmd.")",'~'.expand("<slnum>"))
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12039 let ret= system(cmd)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12040 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12041 " call Dret("s:RemoteSystem ".ret)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12042 return ret
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12043 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12044
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12045 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12046 " s:RestoreWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12047 fun! s:RestoreWinVars()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12048 " call Dfunc("s:RestoreWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12049 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
12050 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
12051 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
12052 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
12053 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
12054 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
12055 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
12056 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
12057 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
12058 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
12059 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
12060 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
12061 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
12062 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
12063 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
12064 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
12065 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
12066 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
12067 " call Dret("s:RestoreWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12068 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12069
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12070 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12071 " s:Rexplore: implements returning from a buffer to a netrw directory {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12072 "
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12073 " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12074 " is true) and a command, :Rexplore, which call this function.
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12075 "
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12076 " s:netrw_posn is set up by s:NetrwBrowseChgDir()
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12077 "
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12078 " s:rexposn_BUFNR used to save/restore cursor position
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12079 fun! s:NetrwRexplore(islocal,dirname)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
12080 if exists("s:netrwdrag")
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
12081 return
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3920
diff changeset
12082 endif
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12083 " call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir."> win#".winnr())
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12084 " call Decho("currently in bufname<".bufname("%").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12085 " call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12086
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12087 if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12088 " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12089 " call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12090 exe "NetrwKeepj e ".w:netrw_rexfile
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12091 unlet w:netrw_rexfile
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12092 " call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")")
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
12093 return
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12094 " else " Decho
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12095 " call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw"),'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12096 " call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12097 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12098
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12099 " ---------------------------
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12100 " :Rex issued while in a file
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12101 " ---------------------------
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12102
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12103 " record current file so :Rex can return to it from netrw
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12104 let w:netrw_rexfile= expand("%")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12105 " call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12106
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12107 if !exists("w:netrw_rexlocal")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12108 " call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft." win#".winnr().")")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12109 return
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12110 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12111 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
12112 if w:netrw_rexlocal
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12113 NetrwKeepj call netrw#LocalBrowseCheck(w:netrw_rexdir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12114 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12115 NetrwKeepj call s:NetrwBrowse(0,w:netrw_rexdir)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12116 endif
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
12117 if exists("s:initbeval")
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12118 setl beval
3153
37ecb8ff4560 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
12119 endif
3456
4dde9b516e72 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3153
diff changeset
12120 if exists("s:rexposn_".bufnr("%"))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12121 " call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12122 " restore position in directory listing
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12123 " call Decho("restoring posn to s:rexposn_".bufnr('%')."<".string(s:rexposn_{bufnr('%')}).">",'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12124 NetrwKeepj call winrestview(s:rexposn_{bufnr('%')})
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12125 if exists("s:rexposn_".bufnr('%'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12126 unlet s:rexposn_{bufnr('%')}
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12127 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12128 else
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12129 " call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12130 endif
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12131
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12132 if has("syntax") && exists("g:syntax_on") && g:syntax_on
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12133 if exists("s:explore_match")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12134 exe "2match netrwMarkFile /".s:explore_match."/"
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12135 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
12136 endif
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12137
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12138 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("<slnum>"))
5734
657ade71d395 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5618
diff changeset
12139 " call Dret("s:NetrwRexplore : ft=".&ft)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12140 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12141
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12142 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12143 " s:SaveBufVars: save selected b: variables to s: variables {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12144 " use s:RestoreBufVars() to restore b: variables from s: variables
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12145 fun! s:SaveBufVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
12146 " call Dfunc("s:SaveBufVars() buf#".bufnr("%"))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12147
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12148 if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12149 if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12150 if exists("b:netrw_method") |let s:netrw_method = b:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12151 if exists("b:netrw_fname") |let s:netrw_fname = b:netrw_fname |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12152 if exists("b:netrw_machine") |let s:netrw_machine = b:netrw_machine |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12153 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
12154
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12155 " call Dret("s:SaveBufVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12156 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12157
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12158 " ---------------------------------------------------------------------
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12159 " s:SavePosn: saves position associated with current buffer into a dictionary {{{2
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12160 fun! s:SavePosn(posndict)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12161 " call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12162
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12163 if !exists("a:posndict[bufnr('%')]")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12164 let a:posndict[bufnr("%")]= []
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12165 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12166 " call Decho("before push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')]))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12167 call add(a:posndict[bufnr("%")],winsaveview())
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12168 " call Decho("after push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')]))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12169
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12170 " call Dret("s:SavePosn posndict")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12171 return a:posndict
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12172 endfun
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12173
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12174 " ---------------------------------------------------------------------
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12175 " s:RestorePosn: restores position associated with current buffer using dictionary {{{2
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12176 fun! s:RestorePosn(posndict)
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12177 " call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">")
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12178 if exists("a:posndict")
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12179 if has_key(a:posndict,bufnr("%"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12180 " call Decho("before pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')]))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12181 let posnlen= len(a:posndict[bufnr("%")])
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12182 if posnlen > 0
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12183 let posnlen= posnlen - 1
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12184 " call Decho("restoring posn posndict[".bufnr("%")."][".posnlen."]=".string(a:posndict[bufnr("%")][posnlen]),'~'.expand("<slnum>"))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12185 call winrestview(a:posndict[bufnr("%")][posnlen])
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12186 call remove(a:posndict[bufnr("%")],posnlen)
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12187 " call Decho("after pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')]))
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12188 endif
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12189 endif
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12190 endif
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12191 " call Dret("s:RestorePosn")
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12192 endfun
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12193
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12194 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12195 " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12196 fun! s:SaveWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
12197 " call Dfunc("s:SaveWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12198 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12199 if exists("w:netrw_col") |let s:col = w:netrw_col |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12200 if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12201 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
12202 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
12203 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
12204 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
12205 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
12206 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
12207 if exists("w:netrw_fpl") |let s:fpl = w:netrw_fpl |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12208 if exists("w:netrw_hline") |let s:hline = w:netrw_hline |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12209 if exists("w:netrw_line") |let s:line = w:netrw_line |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12210 if exists("w:netrw_liststyle") |let s:liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12211 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12212 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12213 if exists("w:netrw_treedict") |let s:treedict = w:netrw_treedict |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12214 if exists("w:netrw_treetop") |let s:treetop = w:netrw_treetop |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12215 if exists("w:netrw_winnr") |let s:winnr = w:netrw_winnr |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12216 " call Dret("s:SaveWinVars")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12217 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12218
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12219 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12220 " s:SetBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12221 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12222 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12223 " 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
12224 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12225 " UseBufWinVars() get around that.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
12226 fun! s:SetBufWinVars()
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1702
diff changeset
12227 " call Dfunc("s:SetBufWinVars() win#".winnr())
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12228 if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12229 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12230 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12231 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12232 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
12233 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
12234 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
12235 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
12236 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
12237 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
12238 " call Dret("s:SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12239 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12240
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12241 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12242 " s:SetRexDir: set directory for :Rexplore {{{2
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12243 fun! s:SetRexDir(islocal,dirname)
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12244 " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">) win#".winnr())
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12245 let w:netrw_rexdir = a:dirname
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12246 let w:netrw_rexlocal = a:islocal
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12247 let s:rexposn_{bufnr("%")} = winsaveview()
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12248 " call Decho("setting w:netrw_rexdir =".w:netrw_rexdir,'~'.expand("<slnum>"))
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12249 " call Decho("setting w:netrw_rexlocal=".w:netrw_rexlocal,'~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12250 " call Decho("saving posn to s:rexposn_".bufnr("%")."<".string(s:rexposn_{bufnr("%")}).">",'~'.expand("<slnum>"))
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12251 " call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to ".string(winsaveview()),'~'.expand("<slnum>"))
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3465
diff changeset
12252 " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12253 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12254
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12255 " ---------------------------------------------------------------------
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12256 " s:ShowLink: used to modify thin and tree listings to show links {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12257 fun! s:ShowLink()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12258 " " call Dfunc("s:ShowLink()")
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12259 " " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12260 " " call Decho(printf("line#%4d: %s",line("."),getline(".")),'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12261 if exists("b:netrw_curdir")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12262 norm! $?\a
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12263 let fname = b:netrw_curdir.'/'.s:NetrwGetWord()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12264 let resname = resolve(fname)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12265 " " call Decho("fname <".fname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12266 " " call Decho("resname <".resname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12267 " " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12268 if resname =~ '^\M'.b:netrw_curdir.'/'
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12269 let dirlen = strlen(b:netrw_curdir)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12270 let resname = strpart(resname,dirlen+1)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12271 " " call Decho("resname<".resname."> (b:netrw_curdir elided)",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12272 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12273 let modline = getline(".")."\t --> ".resname
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12274 " " call Decho("fname <".fname.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12275 " " call Decho("modline<".modline.">",'~'.expand("<slnum>"))
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12276 setl noro ma
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12277 call setline(".",modline)
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12278 setl ro noma nomod
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12279 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12280 " " call Dret("s:ShowLink".((exists("fname")? ' : '.fname : 'n/a')))
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12281 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12282
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12283 " ---------------------------------------------------------------------
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12284 " s:ShowStyle: {{{2
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12285 fun! s:ShowStyle()
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12286 if !exists("w:netrw_liststyle")
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12287 let liststyle= g:netrw_liststyle
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12288 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12289 let liststyle= w:netrw_liststyle
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12290 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12291 if liststyle == s:THINLIST
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12292 return s:THINLIST.":thin"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12293 elseif liststyle == s:LONGLIST
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12294 return s:LONGLIST.":long"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12295 elseif liststyle == s:WIDELIST
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12296 return s:WIDELIST.":wide"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12297 elseif liststyle == s:TREELIST
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12298 return s:TREELIST.":tree"
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12299 else
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12300 return 'n/a'
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12301 endif
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12302 endfun
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12303
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12304 " ---------------------------------------------------------------------
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12305 " s:Strlen: this function returns the length of a string, even if its using multi-byte characters. {{{2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12306 " Solution from Nicolai Weibull, vim docs (:help strlen()),
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12307 " Tony Mechelynck, and my own invention.
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12308 fun! s:Strlen(x)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12309 " "" call Dfunc("s:Strlen(x<".a:x."> g:Align_xstrlen=".g:Align_xstrlen.")")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12310
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12311 if v:version >= 703 && exists("*strdisplaywidth")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12312 let ret= strdisplaywidth(a:x)
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12313
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12314 elseif type(g:Align_xstrlen) == 1
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12315 " allow user to specify a function to compute the string length (ie. let g:Align_xstrlen="mystrlenfunc")
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12316 exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')"
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12317
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12318 elseif g:Align_xstrlen == 1
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12319 " number of codepoints (Latin a + combining circumflex is two codepoints)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12320 " (comment from TM, solution from NW)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12321 let ret= strlen(substitute(a:x,'.','c','g'))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12322
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12323 elseif g:Align_xstrlen == 2
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12324 " number of spacing codepoints (Latin a + combining circumflex is one spacing
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12325 " 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
12326 " (comment from TM, solution from TM)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12327 let ret=strlen(substitute(a:x, '.\Z', 'x', 'g'))
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12328
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12329 elseif g:Align_xstrlen == 3
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12330 " virtual length (counting, for instance, tabs as anything between 1 and
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12331 " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12332 " preceded by lam, one otherwise, etc.)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12333 " (comment from TM, solution from me)
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12334 let modkeep= &l:mod
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12335 exe "norm! o\<esc>"
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12336 call setline(line("."),a:x)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12337 let ret= virtcol("$") - 1
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12338 d
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12339 NetrwKeepj norm! k
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12340 let &l:mod= modkeep
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12341
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12342 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12343 " at least give a decent default
5618
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12344 let ret= strlen(a:x)
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12345 endif
350272cbf1fd Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
12346 " "" call Dret("s:Strlen ".ret)
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12347 return ret
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12348 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12349
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12350 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12351 " s:ShellEscape: shellescape(), or special windows handling {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12352 fun! s:ShellEscape(s, ...)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12353 if (has('win32') || has('win64')) && $SHELL == '' && &shellslash
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12354 return printf('"%s"', substitute(a:s, '"', '""', 'g'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12355 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12356 let f = a:0 > 0 ? a:1 : 0
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12357 return shellescape(a:s, f)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12358 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12359
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12360 " ---------------------------------------------------------------------
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12361 " s:TreeListMove: supports [[, ]], [], and ][ in tree mode {{{2
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12362 fun! s:TreeListMove(dir)
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12363 " call Dfunc("s:TreeListMove(dir<".a:dir.">)")
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12364 let curline = getline('.')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12365 let prvline = (line(".") > 1)? getline(line(".")-1) : ''
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12366 let nxtline = (line(".") < line("$"))? getline(line(".")+1) : ''
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12367 let curindent = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12368 let indentm1 = substitute(curindent,'^'.s:treedepthstring,'','')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12369 let treedepthchr = substitute(s:treedepthstring,' ','','g')
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12370 let stopline = exists("w:netrw_bannercnt")? w:netrw_bannercnt : 1
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12371 " call Decho("prvline <".prvline."> #".(line(".")-1), '~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12372 " call Decho("curline <".curline."> #".line(".") , '~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12373 " call Decho("nxtline <".nxtline."> #".(line(".")+1), '~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12374 " call Decho("curindent<".curindent.">" , '~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12375 " call Decho("indentm1 <".indentm1.">" , '~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12376 " COMBAK : need to handle when on a directory
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12377 " COMBAK : need to handle ]] and ][. In general, needs work!!!
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12378 if curline !~ '/$'
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12379 if a:dir == '[[' && prvline != ''
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12380 NetrwKeepj norm! 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12381 let nl = search('^'.indentm1.'\%('.s:treedepthstring.'\)\@!','bWe',stopline) " search backwards
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12382 " call Decho("regfile srch back: ".nl,'~'.expand("<slnum>"))
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12383 elseif a:dir == '[]' && nxtline != ''
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12384 NetrwKeepj norm! 0
8951
0bdeaf7092bc commit https://github.com/vim/vim/commit/aa3b15dbebf333282503d6031e2f9ba6ee4398ed
Christian Brabandt <cb@256bit.org>
parents: 8148
diff changeset
12385 " call Decho('srchpat<'.'^\%('.curindent.'\)\@!'.'>','~'.expand("<slnum>"))
8148
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12386 let nl = search('^\%('.curindent.'\)\@!','We') " search forwards
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12387 if nl != 0
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12388 NetrwKeepj norm! k
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12389 else
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12390 NetrwKeepj norm! G
f5da459c5698 commit https://github.com/vim/vim/commit/e0fa3742ead676a3074a10edadbc955e1a89153d
Christian Brabandt <cb@256bit.org>
parents: 7183
diff changeset
12391 endif
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12392 " call Decho("regfile srch fwd: ".nl,'~'.expand("<slnum>"))
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12393 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12394 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12395
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12396 " call Dret("s:TreeListMove")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12397 endfun
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12398
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12399 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12400 " 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
12401 " 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
12402 " 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
12403 " 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
12404 fun! s:UpdateBuffersMenu()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12405 " call Dfunc("s:UpdateBuffersMenu()")
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
12406 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
12407 try
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
12408 sil emenu Buffers.Refresh\ menu
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12409 catch /^Vim\%((\a\+)\)\=:E/
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12410 let v:errmsg= ""
6476
11d78e58a487 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5929
diff changeset
12411 sil NetrwKeepj call s:NetrwBMShow()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12412 endtry
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12413 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12414 " call Dret("s:UpdateBuffersMenu")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12415 endfun
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12416
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
12417 " ---------------------------------------------------------------------
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1209
diff changeset
12418 " s:UseBufWinVars: (used by NetrwBrowse() and LocalBrowseCheck() {{{2
2751
b0d34143ebfc Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2426
diff changeset
12419 " Matching function to s:SetBufWinVars()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12420 fun! s:UseBufWinVars()
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12421 " call Dfunc("s:UseBufWinVars()")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
12422 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
12423 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
12424 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
12425 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
12426 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
12427 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
12428 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
12429 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
12430 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
12431 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
12432 " call Dret("s:UseBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12433 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12434
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
12435 " ---------------------------------------------------------------------
7183
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12436 " s:UserMaps: supports user-defined UserMaps {{{2
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12437 " * calls a user-supplied funcref(islocal,curdir)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12438 " * interprets result
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12439 " See netrw#UserMaps()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12440 fun! s:UserMaps(islocal,funcname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12441 " call Dfunc("s:UserMaps(islocal=".a:islocal.",funcname<".a:funcname.">)")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12442
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12443 if !exists("b:netrw_curdir")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12444 let b:netrw_curdir= getcwd()
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12445 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12446 let Funcref = function(a:funcname)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12447 let result = Funcref(a:islocal)
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12448
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12449 if type(result) == 1
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12450 " if result from user's funcref is a string...
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12451 " call Decho("result string from user funcref<".result.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12452 if result == "refresh"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12453 " call Decho("refreshing display",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12454 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12455 elseif result != ""
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12456 " call Decho("executing result<".result.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12457 exe result
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12458 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12459
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12460 elseif type(result) == 3
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12461 " if result from user's funcref is a List...
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12462 " call Decho("result List from user funcref<".string(result).">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12463 for action in result
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12464 if action == "refresh"
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12465 " call Decho("refreshing display",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12466 call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./'))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12467 elseif action != ""
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12468 " call Decho("executing action<".action.">",'~'.expand("<slnum>"))
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12469 exe action
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12470 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12471 endfor
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12472 endif
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12473
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12474 " call Dret("s:UserMaps")
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12475 endfun
ffad29dc7eee commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2
Christian Brabandt <cb@256bit.org>
parents: 6476
diff changeset
12476
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12477 " ==========================
4502
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
12478 " Settings Restoration: {{{1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12479 " ==========================
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12480 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12481 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12482
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12483 " ===============
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12484 " Modelines: {{{1
17433
ca8e754bdd53 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 13965
diff changeset
12485 " ===============
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
12486 " vim:ts=8 fdm=marker