Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 1 | *pi_netrw.txt For Vim version 6.2. Last change: Jul 30, 2004 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Charles E. Campbell, Jr. |
| 5 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 6 | *dav* *http* *network* *rcp* *scp* |
| 7 | *fetch* *netrw* *Nread* *rsync* *sftp* |
| 8 | *ftp* *netrw.vim* *Nwrite* *netrw-file* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | |
| 10 | ============================================================================== |
| 11 | 0. Contents *netrw-contents* |
| 12 | |
| 13 | 1. Netrw Reference.....................................|netrw-ref| |
| 14 | 2. Network-Oriented File Transfer......................|netrw-xfer| |
| 15 | 3. Activation..........................................|netrw-activate| |
| 16 | 4. Transparent File Transfer...........................|netrw-transparent| |
| 17 | 5. Ex Commands.........................................|netrw-ex| |
| 18 | 6. Variables and Options...............................|netrw-var| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 19 | 7. Directory Browser...................................|netrw-browse| |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 20 | 8. Debugging...........................................|netrw-debug| |
| 21 | 9. History.............................................|netrw-history| |
| 22 | 10. Credits.............................................|netrw-credits| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | |
| 24 | The functionality mentioned here is done via using |standard-plugin| |
| 25 | techniques. This plugin is only available if |
| 26 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 27 | set nocp " 'compatible' is not set |
| 28 | filetype plugin on " plugins are enabled |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 29 | |
| 30 | You can avoid loading this plugin by setting the "loaded_netrw" variable |
| 31 | in your <.vimrc> file: > |
| 32 | |
| 33 | :let loaded_netrw = 1 |
| 34 | |
| 35 | {Vi does not have any of this} |
| 36 | |
| 37 | ============================================================================== |
| 38 | 1. Netrw Reference *netrw-ref* |
| 39 | |
| 40 | OPTIONS |
| 41 | let g:netrw_ftp =0 use ftp (default) (uid password) |
| 42 | =1 use alternate ftp method (user uid password) |
| 43 | If you're having trouble with ftp, try changing the value |
| 44 | of this variable in your <.vimrc> to change methods |
| 45 | |
| 46 | let g:netrw_ignorenetrc= 1 |
| 47 | If you have a <.netrc> file but it doesn't work and you |
| 48 | want it ignored, then set this variable as shown. Its mere |
| 49 | existence is enough to cause <.netrc> to be ignored. |
| 50 | |
| 51 | Controlling External Applications |
| 52 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 53 | Protocol Variable Default Value |
| 54 | -------- ---------------- ------------- |
| 55 | dav: g:netrw_dav_cmd = "cadaver" |
| 56 | fetch: g:netrw_fetch_cmd = "fetch -o" |
| 57 | ftp: g:netrw_ftp_cmd = "ftp" |
| 58 | http: g:netrw_http_cmd = "fetch -o" if fetch is available |
| 59 | http: g:netrw_http_cmd = "wget -q -O" If wget is available |
| 60 | rcp: g:netrw_rcp_cmd = "rcp" |
| 61 | rsync: g:netrw_rsync_cmd = "rsync -a" |
| 62 | scp: g:netrw_scp_cmd = "scp -q" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 63 | sftp: g:netrw_sftp_cmd = "sftp" |
| 64 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 65 | READING *netrw-read* *netrw-nread* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 66 | :Nread ? give help |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 67 | :Nread "machine:path" uses rcp |
| 68 | :Nread "machine path" uses ftp with <.netrc> |
| 69 | :Nread "machine id password path" uses ftp |
| 70 | :Nread "dav://machine[:port]/path" uses cadaver |
| 71 | :Nread "fetch://[user@]machine/path" uses fetch |
| 72 | :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc> |
| 73 | :Nread "http://[user@]machine/path" uses http uses wget |
| 74 | :Nread "rcp://[user@]machine/path" uses rcp |
| 75 | :Nread "rsync://[user@]machine[:port]/path" uses rsync |
| 76 | :Nread "scp://[user@]machine[[:#]port]/path" uses scp |
| 77 | :Nread "sftp://[user@]machine/path" uses sftp |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 78 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 79 | WRITING *netrw-write* *netrw-nwrite* |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 80 | :Nwrite ? give help |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 81 | :Nwrite "machine:path" uses rcp |
| 82 | :Nwrite "machine path" uses ftp with <.netrc> |
| 83 | :Nwrite "machine id password path" uses ftp |
| 84 | :Nwrite "dav://machine[:port]/path" uses cadaver |
| 85 | :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc> |
| 86 | :Nwrite "rcp://[user@]machine/path" uses rcp |
| 87 | :Nwrite "rsync://[user@]machine[:port]/path" uses rsync |
| 88 | :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp |
| 89 | :Nwrite "sftp://[user@]machine/path" uses sftp |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 90 | http: not supported! |
| 91 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 92 | DIRECTORY LISTING |
| 93 | :Nread [protocol]://[user]@hostname/path/ |
| 94 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 95 | USER AND PASSWORD CHANGING |
| 96 | Attempts to use ftp will prompt you for a user-id and a password. |
| 97 | These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses |
| 98 | of ftp will re-use those. If you need to use a different user id |
| 99 | and/or password, you'll want to call NetUserPass() first. |
| 100 | |
| 101 | :NetUserPass [uid [password]] -- prompts as needed |
| 102 | :call NetUserPass() -- prompts for uid and password |
| 103 | :call NetUserPass("uid") -- prompts for password |
| 104 | :call NetUserPass("uid","password") -- sets global uid and password |
| 105 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 106 | VARIABLES *netrw-variables* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 107 | b:netrw_lastfile last file Network-read/written retained on |
| 108 | a per-buffer basis (supports plain :Nw ) |
| 109 | s:netrw_line during Nw/NetWrite, holds current line number |
| 110 | s:netrw_col during Nw/NetWrite, holds current column number |
| 111 | s:netrw_line and s:netrw_col are used to |
| 112 | restore the cursor position on writes |
| 113 | g:netrw_ftp if it doesn't exist, use default ftp |
| 114 | =0 use default ftp (uid password) |
| 115 | =1 use alternate ftp method (user uid password) |
| 116 | g:netrw_ftpmode ="binary" (default) |
| 117 | ="ascii" (or your choice) |
| 118 | g:netrw_uid (ftp) user-id, retained on a per-session basis |
| 119 | g:netrw_passwd (ftp) password, retained on a per-session basis |
| 120 | g:netrw_win95ftp =0 use unix-style ftp even if win95/win98/winME |
| 121 | =1 use default method to do ftp |
| 122 | g:netrw_cygwin =1 assume scp under windows is from cygwin |
| 123 | (default if windows) |
| 124 | =0 assume scp under windows accepts |
| 125 | windows-style paths (default otherwise) |
| 126 | g:netrw_use_nt_rcp=0 don't use the rcp of WinNT, Win2000 and WinXP (default) |
| 127 | =1 use the rcp of WinNT,... in binary mode |
| 128 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 129 | PATHS *netrw-path* |
| 130 | |
| 131 | Paths to files are generally user-directory relative for most protocols. |
| 132 | It is possible that some protocol will make paths relative to some |
| 133 | associated directory, however. |
| 134 | |
| 135 | example: vim scp://user@host/somefile |
| 136 | example: vim scp://user@host/subdir1/subdir2/somefile |
| 137 | |
| 138 | where "somefile" is the "user"'s home directory. If you wish to get a |
| 139 | file using root-relative paths, use the full path: |
| 140 | |
| 141 | example: vim scp://user@host//somefile |
| 142 | example: vim scp://user@host//subdir1/subdir2/somefile |
| 143 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 144 | |
| 145 | ============================================================================== |
| 146 | 2. Network-Oriented File Transfer *netrw-xfer* |
| 147 | |
| 148 | Network-oriented file transfer under Vim is implemented by a VimL-based script |
| 149 | (<netrw.vim>) using plugin techniques. It currently supports both reading |
| 150 | and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, |
| 151 | dav/cadaver, rsync, or sftp. |
| 152 | |
| 153 | http is currently supported read-only via use of wget or fetch. |
| 154 | |
| 155 | <netrw.vim> is a standard plugin which acts as glue between Vim and the |
| 156 | various file transfer programs. It uses autocommand events (BufReadCmd, |
| 157 | FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. > |
| 158 | |
| 159 | ex. vim ftp://hostname/path/to/file |
| 160 | < |
| 161 | The characters preceding the colon specify the protocol to use; |
| 162 | in the example, its ftp. The <netrw.vim> script then formulates |
| 163 | a command or a series of commands (typically ftp) which it issues |
| 164 | to an external program (ftp, scp, etc) which does the actual file |
| 165 | transfer/protocol. Files are read from/written to a temporary file |
| 166 | (under Unix/Linux, /tmp/...) which the <netrw.vim> script will |
| 167 | clean up. |
| 168 | |
| 169 | One may modify any protocol's implementing external application |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 170 | by settinbg a variable (ex. scp uses the variable g:netrw_scp_cmd, |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 171 | which is defaulted to "scp -q"). |
| 172 | |
| 173 | Ftp, an old protocol, seems to be blessed by numerous implementations. |
| 174 | Unfortunately, some implementations are noisy (ie., add junk to the end |
| 175 | of the file). Thus, concerned users may decide to write a NetReadFixup() |
| 176 | function that will clean up after reading with their ftp. Some Unix systems |
| 177 | (ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol |
| 178 | but is not noisy and more convenient, actually, for <netrw.vim> to use. |
| 179 | Consequently, if "fetch" is executable, it will be used to do reads for |
| 180 | ftp://... (and http://...) . See |netrw-var| for more about this. |
| 181 | |
| 182 | For rcp, scp, sftp, and http, one may use network-oriented file transfers |
| 183 | transparently; ie. |
| 184 | > |
| 185 | vim rcp://[user@]machine/path |
| 186 | vim scp://[user@]machine/path |
| 187 | < |
| 188 | If your ftp supports <.netrc>, then it too can be just as transparently used |
| 189 | if the needed triad of machine name, user id, and password are present in |
| 190 | that file. Your ftp must be able to use the <.netrc> file on its own, however. |
| 191 | > |
| 192 | vim ftp://[user@]machine[[:#]portnumber]/path |
| 193 | < |
| 194 | However, ftp will often need to query the user for the userid and password. |
| 195 | The latter will be done "silently"; ie. asterisks will show up instead of |
| 196 | the actually-typed-in password. Netrw will retain the userid and password |
| 197 | for subsequent read/writes from the most recent transfer so subsequent |
| 198 | transfers (read/write) to or from that machine will take place without |
| 199 | additional prompting. |
| 200 | |
| 201 | *netrw-urls* |
| 202 | +=================================+============================+============+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 203 | | Reading | Writing | Uses | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 204 | +=================================+============================+============+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 205 | | DAV: | | | |
| 206 | | dav://host/path | | cadaver | |
| 207 | | :Nread dav://host/path | :Nwrite dav://host/path | cadaver | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 208 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 209 | | FETCH: | | | |
| 210 | | fetch://[user@]host/path | | | |
| 211 | | fetch://[user@]host:http/path | Not Available | fetch | |
| 212 | | :Nread fetch://[user@]host/path| | | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 213 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 214 | | FILE: | | | |
| 215 | | file:///* | file:///* | | |
| 216 | | file://localhost/* | file://localhost/* | | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 217 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 218 | | FTP: (*3) | (*3) | | |
| 219 | | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) | |
| 220 | | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc | |
| 221 | | :Nread host path | :Nwrite host path | ftp+.netrc | |
| 222 | | :Nread host uid pass path | :Nwrite host uid pass path | ftp | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 223 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 224 | | HTTP: wget is executable: (*4) | | | |
| 225 | | http://[user@]host/path | Not Available | wget | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 226 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 227 | | HTTP: fetch is executable (*4) | | | |
| 228 | | http://[user@]host/path | Not Available | fetch | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 229 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 230 | | RCP: | | | |
| 231 | | rcp://[user@]host/path | rcp://[user@]host/path | rcp | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 232 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 233 | | RSYNC: | | | |
| 234 | | rsync://[user@]host/path | rsync://[user@]host/path | rsync | |
| 235 | | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync | |
| 236 | | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 237 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 238 | | SCP: | | | |
| 239 | | scp://[user@]host/path | scp://[user@]host/path | scp | |
| 240 | | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 241 | +---------------------------------+----------------------------+------------+ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 242 | | SFTP: | | | |
| 243 | | sftp://[user@]host/path | sftp://[user@]host/path | sftp | |
| 244 | | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 245 | +=================================+============================+============+ |
| 246 | |
| 247 | (*1) For an absolute path use scp://machine//path. |
| 248 | |
| 249 | (*2) if <.netrc> is present, it is assumed that it will |
| 250 | work with your ftp client. Otherwise the script will |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 251 | prompt for user-id and pasword. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 252 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 253 | (*3) for ftp, "machine" may be machine#port or machine:port |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 254 | if a different port is needed than the standard ftp port |
| 255 | |
| 256 | (*4) for http:..., if wget is available it will be used. Otherwise, |
| 257 | if fetch is available it will be used. |
| 258 | |
| 259 | Both the :Nread and the :Nwrite ex-commands can accept multiple filenames. |
| 260 | |
| 261 | |
| 262 | NETRC *netrw-netrc* |
| 263 | |
| 264 | The typical syntax for lines in a <.netrc> file is given as shown below. |
| 265 | Ftp under Unix usually support <.netrc>; Windows' ftp usually doesn't. |
| 266 | > |
| 267 | machine {full machine name} login {user-id} password "{password}" |
| 268 | default login {user-id} password "{password}" |
| 269 | |
| 270 | Your ftp client must handle the use of <.netrc> on its own, but if the |
| 271 | <.netrc> file exists, an ftp transfer will not ask for the user-id or |
| 272 | password. |
| 273 | |
| 274 | Note: |
| 275 | Since this file contains passwords, make very sure nobody else can |
| 276 | read this file! Most programs will refuse to use a .netrc that is |
| 277 | readable for others. Don't forget that the system administrator can |
| 278 | still read the file! |
| 279 | |
| 280 | |
| 281 | PASSWORD *netrw-passwd* |
| 282 | |
| 283 | The script attempts to get passwords for ftp invisibly using |inputsecret()|, |
| 284 | a built-in Vim function. See |netrw-uidpass| for how to change the password |
| 285 | after one has set it. |
| 286 | |
| 287 | Unfortunately there doesn't appear to be a way for netrw to feed a password |
| 288 | to scp. Thus every transfer via scp will require re-entry of the password. |
| 289 | |
| 290 | |
| 291 | ============================================================================== |
| 292 | 3. Activation *netrw-activate* |
| 293 | |
| 294 | Network-oriented file transfers are available by default whenever |
| 295 | |'nocompatible'| mode is enabled. The <netrw.vim> file resides in your |
| 296 | system's vim-plugin directory and is sourced automatically whenever you |
| 297 | bring up vim. |
| 298 | |
| 299 | |
| 300 | ============================================================================== |
| 301 | 4. Transparent File Transfer *netrw-transparent* |
| 302 | |
| 303 | Transparent file transfers occur whenever a regular file read or write |
| 304 | (invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made. |
| 305 | Thus one may use files across networks as if they were local. > |
| 306 | |
| 307 | vim ftp://[user@]machine/path |
| 308 | ... |
| 309 | :wq |
| 310 | |
| 311 | |
| 312 | ============================================================================== |
| 313 | 5. Ex Commands *netrw-ex* |
| 314 | |
| 315 | The usual read/write commands are supported. There are also a couple of |
| 316 | additional commands available. |
| 317 | |
| 318 | :[range]Nw Write the specified lines to the current |
| 319 | file as specified in b:netrw_lastfile. |
| 320 | |
| 321 | :[range]Nw {netfile} [{netfile}]... |
| 322 | Write the specified lines to the {netfile}. |
| 323 | |
| 324 | :Nread |
| 325 | Read the specified lines into the current |
| 326 | buffer from the file specified in |
| 327 | b:netrw_lastfile. |
| 328 | |
| 329 | :Nread {netfile} {netfile}... |
| 330 | Read the {netfile} after the current line. |
| 331 | |
| 332 | *netrw-uidpass* |
| 333 | :call NetUserPass() |
| 334 | If b:netrw_uid and b:netrw_passwd don't exist, |
| 335 | this function query the user for them. |
| 336 | |
| 337 | :call NetUserPass("userid") |
| 338 | This call will set the b:netrw_uid and, if |
| 339 | the password doesn't exist, will query the user for it. |
| 340 | |
| 341 | :call NetUserPass("userid","passwd") |
| 342 | This call will set both the b:netrw_uid and b:netrw_passwd. |
| 343 | The user-id and password are used by ftp transfers. One may |
| 344 | effectively remove the user-id and password by using "" |
| 345 | strings. |
| 346 | |
| 347 | |
| 348 | ============================================================================== |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 349 | 6. Variables and Options *netrw-options* *netrw-var* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 350 | |
| 351 | The script <netrw.vim> uses several variables which can affect <netrw.vim>'s |
| 352 | behavior. These variables typically may be set in the user's <.vimrc> file: |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 353 | > |
| 354 | ------------- |
| 355 | Netrw Options |
| 356 | ------------- |
| 357 | Option Meaning |
| 358 | -------------- ----------------------------------------------- |
| 359 | < |
| 360 | b:netrw_col Holds current cursor position (during NetWrite) |
| 361 | g:netrw_cygwin =1 assume scp under windows is from cygwin |
| 362 | (default/windows) |
| 363 | =0 assume scp under windows accepts windows |
| 364 | style paths (default/else) |
| 365 | g:netrw_ftp =0 use default ftp (uid password) |
| 366 | g:netrw_ftpmode ="binary" (default) |
| 367 | ="ascii" (your choice) |
| 368 | g:netrw_ignorenetrc =1 (default) |
| 369 | if you have a <.netrc> file but you don't |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 370 | want it used, then set this variable. Its |
| 371 | mere existence is enough to cause <.netrc> |
| 372 | to be ignored. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 373 | b:netrw_lastfile Holds latest method/machine/path. |
| 374 | b:netrw_line Holds current line number (during NetWrite) |
| 375 | g:netrw_passwd Holds current password for ftp. |
| 376 | g:netrw_silent =0 transfers done normally |
| 377 | =1 transfers done silently |
| 378 | g:netrw_uid Holds current user-id for ftp. |
| 379 | =1 use alternate ftp (user uid password) |
| 380 | (see |netrw-options|) |
| 381 | g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default) |
| 382 | =1 use WinNT/2K/XP's rcp, binary mode |
| 383 | g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc |
| 384 | =1 use default method to do ftp > |
| 385 | ----------------------------------------------------------------------- |
| 386 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 387 | The script will also make use of the following variables internally, albeit |
| 388 | temporarily. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 389 | > |
| 390 | ------------------- |
| 391 | Temporary Variables |
| 392 | ------------------- |
| 393 | Variable Meaning |
| 394 | -------- ------------------------------------ |
| 395 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 396 | g:netrw_method Index indicating rcp/ftp+.netrc/ftp |
| 397 | g:netrw_machine Holds machine name parsed from input |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 398 | g:netrw_fname Holds filename being accessed > |
| 399 | ------------------------------------------------------------ |
| 400 | < |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 401 | *netrw-protocol* |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 402 | |
| 403 | Netrw supports a number of protocols. These protocols are invoked using the |
| 404 | variables listed below, and may be modified by the user. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 405 | > |
| 406 | ------------------------ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 407 | Protocol Control Options |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 408 | ------------------------ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 409 | Option Type Setting Meaning |
| 410 | --------- -------- -------------- --------------------------- |
| 411 | < |
| 412 | netrw_ftp variable =doesn't exist userid set by "user userid" |
| 413 | =0 userid set by "user userid" |
| 414 | =1 userid set by "userid" |
| 415 | NetReadFixup function =doesn't exist no change |
| 416 | =exists Allows user to have files |
| 417 | read via ftp automatically |
| 418 | transformed however they wish |
| 419 | by NetReadFixup() |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 420 | g:netrw_dav_cmd variable ="cadaver" |
| 421 | g:netrw_fetch_cmd variable ="fetch -o" |
| 422 | g:netrw_ftp_cmd variable ="ftp" |
| 423 | g:netrw_http_cmd variable ="fetch -o" else if fetch is executable |
| 424 | g:netrw_http_cmd variable ="wget -O" if wget is executable |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 425 | g:netrw_list_cmd variable ="ssh HOSTNAME ls -Fa" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 426 | g:netrw_rcp_cmd variable ="rcp" |
| 427 | g:netrw_rsync_cmd variable ="rsync -a" |
| 428 | g:netrw_scp_cmd variable ="scp -q" |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 429 | g:netrw_sftp_cmd variable ="sftp" > |
| 430 | ------------------------------------------------------------------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 431 | < |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 432 | *netrw-ftp* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 433 | The first two options both help with certain ftp's that give trouble otherwise. |
| 434 | In order to best understand how to use these options if ftp is giving you |
| 435 | troubles, a bit of discussion follows on how netrw does ftp reads. |
| 436 | |
| 437 | The g:netrw_..._cmd variables specify the external program to use handle |
| 438 | the associated protocol (rcp, ftp, etc), plus any options. |
| 439 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 440 | The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with |
| 441 | whatever the current request is for a hostname. |
| 442 | |
| 443 | For ftp, netrw typically builds up lines of one of the following formats in a |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 444 | temporary file: |
| 445 | > |
| 446 | IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1 |
| 447 | ---------------------------------- ------------------------------ |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 448 | < |
| 449 | open machine [port] open machine [port] |
| 450 | user userid password userid password |
| 451 | [g:netrw_ftpmode] password |
| 452 | get filename tempfile [g:netrw_ftpmode] |
| 453 | get filename tempfile > |
| 454 | --------------------------------------------------------------------- |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 455 | < |
| 456 | Netrw then executes the lines above by use of a filter: |
| 457 | > |
| 458 | :%! {g:netrw_ftp_cmd} -i [-n] |
| 459 | < |
| 460 | |
| 461 | where |
| 462 | g:netrw_ftp_cmd is usually "ftp", |
| 463 | -i tells ftp not to be interactive |
| 464 | -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>) |
| 465 | |
| 466 | If <.netrc> exists it will be used to avoid having to query the user for |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 467 | userid and password. The transferred file is put into a temporary file. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 468 | The temporary file is then read into the main editing session window that |
| 469 | requested it and the temporary file deleted. |
| 470 | |
| 471 | If your ftp doesn't accept the "user" command and immediately just demands |
| 472 | a userid, then try putting "let netrw_ftp=1" in your <.vimrc>. |
| 473 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 474 | *netrw-cadaver* |
| 475 | To handle the SSL certificate dialog for untrusted servers, one may pull |
| 476 | down the certificate and place it into /usr/ssl/cert.pem. This operation |
| 477 | renders the server treatment as "trusted". |
| 478 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 479 | *netrw-fixup* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 480 | If your ftp for whatever reason generates unwanted lines (such as AUTH |
| 481 | messages) you may write a NetReadFixup(tmpfile) function: |
| 482 | > |
| 483 | function! NetReadFixup(method,line1,line2) |
| 484 | " a:line1: first new line in current file |
| 485 | " a:line2: last new line in current file |
| 486 | if a:method == 1 "rcp |
| 487 | elseif a:method == 2 "ftp + <.netrc> |
| 488 | elseif a:method == 3 "ftp + machine,uid,password,filename |
| 489 | elseif a:method == 4 "scp |
| 490 | elseif a:method == 5 "http/wget |
| 491 | elseif a:method == 6 "dav/cadaver |
| 492 | elseif a:method == 7 "rsync |
| 493 | elseif a:method == 8 "fetch |
| 494 | elseif a:method == 9 "sftp |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 495 | else " complain |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 496 | endif |
| 497 | endfunction |
| 498 | > |
| 499 | The NetReadFixup() function will be called if it exists and thus allows |
| 500 | you to customize your reading process. As a further example, <netrw.vim> |
| 501 | contains just such a function to handle Windows 95 ftp. For whatever |
| 502 | reason, Windows 95's ftp dumps four blank lines at the end of a transfer, |
| 503 | and so it is desirable to automate their removal. Here's some code taken |
| 504 | from <netrw.vim> itself: |
| 505 | > |
| 506 | if has("win95") && g:netrw_win95ftp |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 507 | fun! NetReadFixup(method, line1, line2) |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 508 | if method == 3 " ftp (no <.netrc>) |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 509 | let fourblanklines= line2 - 3 |
| 510 | silent fourblanklines.",".line2."g/^\s*/d" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 511 | endif |
| 512 | endfunction |
| 513 | endif |
| 514 | > |
| 515 | |
| 516 | ============================================================================== |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 517 | 7. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help* |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 518 | ?..........Help....................................|netrw-help| |
| 519 | <cr>.......Browsing................................|netrw-cr| |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 520 | <del>......Deleting Files or Directories...........|netrw-delete| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 521 | -..........Going Up................................|netrw--| |
| 522 | a..........Hiding Files or Directories.............|netrw-a| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 523 | b..........Bookmarking a Directory.................|netrw-b| |
| 524 | B..........Changing to a Bookmarked Directory......|netrw-B| |
| 525 | c..........Make Browsing Directory The Current Dir.|netrw-c| |
| 526 | d..........Make A New Directory....................|netrw-d| |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 527 | D..........Deleting Files or Directories...........|netrw-D| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 528 | <c-h>......Edit File/Directory Hiding List.........|netrw-h| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 529 | i..........Long Listing............................|netrw-i| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 530 | <c-l>......Refreshing the Listing..................|netrw-ctrl-l| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 531 | o..........Browsing with a Horizontal Split........|netrw-o| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 532 | q..........Listing Bookmarks.......................|netrw-q| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 533 | r..........Reversing Sorting Order.................|netrw-r| |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 534 | R..........Renaming Files or Directories...........|netrw-R| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 535 | s..........Selecting Sorting Style.................|netrw-s| |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 536 | S..........Editing the Sorting Sequence............|netrw-S| |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 537 | v..........Browsing with a Vertical Split..........|netrw-v| |
| 538 | x..........Customizing Browsing....................|netrw-x| |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 539 | |
| 540 | QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 541 | > |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 542 | ------- ----------- |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 543 | Command Explanation |
| 544 | ------- ----------- |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 545 | ? Causes Netrw to issue help |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 546 | <cr> Netrw will enter the directory or read the file |
| 547 | <del> Netrw will attempt to remove the file/directory |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 548 | d Make a directory |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 549 | D Netrw will attempt to remove the file(s)/directory(ies) |
| 550 | R Netrw will attempt to rename the file(s)/directory(ies) |
| 551 | - Makes Netrw go up one directory |
| 552 | a Show all of a directory (temporarily ignore g:netrw_list_hide) |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 553 | c Make current browsing directory the current directory |
| 554 | <c-h> Edit file hiding list |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 555 | i Toggles between long and short listing |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 556 | <c-l> Causes Netrw to refresh the directory listing |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 557 | o Enter the file/directory under the cursor in a new browser |
| 558 | window. A horizontal split is used. |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 559 | r Reverse sorting order |
| 560 | s Select sorting style: by name, time, or file size |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 561 | v Enter the file/directory under the cursor in a new browser |
| 562 | window. A vertical split is used. |
| 563 | x Apply a function to a file. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 564 | < |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 565 | NETRW BROWSER VARIABLES *netrw-browse-var* |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 566 | > |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 567 | --- ----------- |
| 568 | Var Explanation |
| 569 | --- ----------- |
| 570 | g:netrw_ftp_browse_reject ftp can produce a number of errors |
| 571 | and warnings that can show up as |
| 572 | "directories" and "files" in the |
| 573 | listing. This pattern is used to |
| 574 | remove such embedded messages. |
| 575 | g:netrw_keepdir keep current directory immune from the |
| 576 | browsing directory. The browsing |
| 577 | directory is contained in b:netrw_curdir |
| 578 | g:netrw_list_cmd command for listing remote directories |
| 579 | g:netrw_list_hide comma separated list of patterns for |
| 580 | hiding files |
| 581 | g:netrw_local_mkdir command for making a local directory |
| 582 | g:netrw_local_rmdir remove directory command (rmdir) |
| 583 | g:netrw_local_rename rename file/directory command |
| 584 | unix-default: rm win32-default: ren |
| 585 | g:netrw_mkdir_cmd command for making a remote directory |
| 586 | g:netrw_rm_cmd command for removing files |
| 587 | g:netrw_rmdir_cmd command for removing directories |
| 588 | g:netrw_rmf_cmd command for removing softlinks |
| 589 | g:netrw_hide if true, the hiding list is used |
| 590 | g:netrw_sort_by sort by "name", "time", or "size" |
| 591 | g:netrw_sort_direction sorting direction: "normal" or "reverse" |
| 592 | g:netrw_sort_sequence when sorting by name, first sort by the |
| 593 | comma-separated pattern sequence |
| 594 | g:netrw_timefmt specify format string to strftime() (%c) |
| 595 | g:netrw_winsize specify initial size of new o/v windows |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 596 | < |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 597 | INTRODUCTION TO DIRECTORY BROWSING |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 598 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 599 | Netrw supports the browsing of directories on the local system and on remote |
| 600 | hosts, including generating listing directories, entering directories, editing |
| 601 | files therein, deleting files/directories, making new directories, and moving |
| 602 | (renaming) files and directories. The Netrw browser generally implements the |
| 603 | previous explorer maps and commands for remote directories, although details |
| 604 | (such as pertinent global variable names) necessarily differ. |
| 605 | |
| 606 | The Netrw remote file and directory browser handles two protocols: ssh and |
| 607 | ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp |
| 608 | in its remote browsing. Any other protocol will be used for file transfers, |
| 609 | but otherwise the ssh protocol will be used to do remote directory browsing. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 610 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 611 | To enter the netrw directory browser, simply attempt to read a "file" with a |
| 612 | trailing slash and it will be interpreted as a request to list a directory: |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 613 | |
| 614 | vim [protocol]://[user@]hostname/path/ |
| 615 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 616 | If you'd like to avoid entering the password in for directory listings, scp, |
| 617 | ssh interaction, etc, see |netrw-list-hack|. |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 618 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 619 | REFRESHING THE LISTING *netrw-ctrl-l* |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 620 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 621 | To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or |
| 622 | hit the <cr> when atop the ./ directory entry in the listing. One may also |
| 623 | refresh a local directory by using ":e .". |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 624 | |
| 625 | |
| 626 | GOING UP *netrw--* |
| 627 | |
| 628 | To go up a directory, press - or his the <cr> when atop the ../ directory |
| 629 | entry in the listing. |
| 630 | |
| 631 | Netrw will modify the command in *g:netrw_list_cmd* to perform the directory |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 632 | listing operation. By default the command is: |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 633 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 634 | ssh HOSTNAME ls -FLa |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 635 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 636 | where the HOSTNAME becomes the [user@]hostname as requested by the attempt to |
| 637 | read. Naturally, the user may override this command with whatever is |
| 638 | preferred. The NetList function which implements remote directory browsing |
| 639 | expects that directories will be flagged by a trailing slash. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 640 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 641 | |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 642 | BROWSING *netrw-cr* |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 643 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 644 | Browsing is simple: move the cursor onto a file or directory of interest. |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 645 | Hitting the <cr> (the return key) will select the file or directory. |
| 646 | Directories will themselves be listed, and files will be opened using the |
| 647 | protocol given in the original read request. |
| 648 | |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 649 | LONG VS SHORT LISTING *netrw-i* |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 650 | |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 651 | The short listing format gives just the files' and directories' names. |
| 652 | The long listing is either based on the "ls" command via ssh for remote |
| 653 | directories or displays the filename, file size (in bytes), and the |
| 654 | time and date of last modification for local directories. |
| 655 | |
| 656 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 657 | MAKING A NEW DIRECTORY *netrw-d* |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 658 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 659 | With the "d" map one may make a new directory either remotely (which |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 660 | depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on |
| 661 | the global variable g:netrw_local_mkdir). Netrw will issue a request for the |
| 662 | new directory's name. A bare <CR> at that point will abort the making of the |
| 663 | directory. Attempts to make a local directory that already exists (as either |
| 664 | a file or a directory) will be detected, reported on, and ignored. |
| 665 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 666 | DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 667 | |
| 668 | Deleting/removing files and directories involves moving the cursor to the |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 669 | file/directory to be deleted and pressing "D". Directories must be empty first |
| 670 | before they can be successfully removed. If the directory is a softlink to a |
| 671 | directory, then netrw will make two requests to remove the directory before |
| 672 | succeeding. Netrw will ask for confirmation before doing the removal(s). |
| 673 | You may select a range of lines with the "V" command (visual selection), |
| 674 | and then pressing "D". |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 675 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 676 | *g:netrw_rm_cmd* |
| 677 | The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used |
| 678 | to control the attempts to remove files and directories. The g:netrw_rm_cmd |
| 679 | is used with files, and its default value is: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 680 | |
| 681 | g:netrw_rm_cmd: ssh HOSTNAME rm |
| 682 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 683 | *g:netrw_rmdir_cmd* |
| 684 | The g:netrw_rmdir_cmd variable is used to support the removal of directories. |
| 685 | Its default value is: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 686 | |
| 687 | g:netrw_rmdir_cmd: ssh HOSTNAME rmdir |
| 688 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 689 | *g:netrw_rmf_cmd* |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 690 | If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 691 | to remove it again using the g:netrw_rmf_cmd variable. Its default value is: |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 692 | |
| 693 | g:netrw_rmf_cmd: ssh HOSTNAME rm -f |
| 694 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 695 | |
Bram Moolenaar | 8299df9 | 2004-07-10 09:47:34 +0000 | [diff] [blame] | 696 | RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 697 | |
| 698 | Renaming/moving files and directories involves moving the cursor to the |
| 699 | file/directory to be moved (renamed) and pressing "R". You will then be |
| 700 | queried for where you want the file/directory to be moved. You may select a |
| 701 | range of lines with the "V" command (visual selection), and then pressing "R". |
| 702 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 703 | The g:netrw_rename_cmd variable is used to implement renaming. By default its |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 704 | value is: |
| 705 | |
| 706 | ssh HOSTNAME mv |
| 707 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 708 | One may rename a block of files and directories by selecting them with |
| 709 | the V (|linewise-visual|). |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 710 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 711 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 712 | HIDING FILES OR DIRECTORIES *g:netrw-a* *g:netrw_list_hide* |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 713 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 714 | The "a" map toggles the netrw vim file browser (both remote and local) between |
| 715 | displaying hidden files (show-all) versus hiding files. For files to be |
| 716 | hidden, the g:netrw_list_hide variable must hold a comma delimited list of |
| 717 | patterns (ex. \.obj) to be hidden from normal listing. (see |netrw-h|) |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 718 | |
| 719 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 720 | EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 721 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 722 | The "<ctrl-h>" map brings up a requestor allowing the user to change the |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 723 | file/directory hiding list. The hiding list consists of one or more patterns |
| 724 | delimited by commas. Files and/or directories satisfying these patterns will |
| 725 | be hidden (ie. not shown). |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 726 | |
| 727 | |
| 728 | BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* |
| 729 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 730 | Normally one enters a file or directory using the <cr>. However, the "o" map |
| 731 | allows one to open a new window to hold the new directory listing or file. A |
| 732 | horizontal split is used. (also see |netrw-v|) |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 733 | |
| 734 | |
| 735 | SELECTING SORTING STYLE *netrw-s* |
| 736 | |
| 737 | One may select the sorting style by name, time, or (file) size. The |
| 738 | "s" map allows one to circulate among the three choices; the directory |
| 739 | listing will automatically be refreshed to reflect the selected style. |
| 740 | |
| 741 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 742 | EDITING THE SORTING SEQUENCE *netrw-S* |
| 743 | |
| 744 | When "Sorted by" is name, one may specify priority via the sorting |
| 745 | sequence (g:netrw_sort_sequence). The sorting sequence typically |
| 746 | prioritizes the name-listing by suffix, although any pattern will do. |
| 747 | Patterns are delimited by commas. The default sorting sequence is: |
| 748 | > |
| 749 | /$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$ |
| 750 | < |
| 751 | The lone * is where all filenames not covered by one of the other |
| 752 | patterns will end up. One may change the sorting sequence by modifying |
| 753 | the g:netrw_sort_sequence variable (either manually or in your <.vimrc>) |
| 754 | or by using the "S" map. |
| 755 | |
| 756 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 757 | REVERSING SORTING ORDER *netrw-r* |
| 758 | |
| 759 | One may toggle between normal and reverse sorting order by pressing the |
| 760 | "r" key. |
| 761 | |
| 762 | |
| 763 | BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* |
| 764 | |
| 765 | Normally one enters a file or directory using the <cr>. However, the "v" |
| 766 | map allows one to open a new window to hold the new directory listing or |
| 767 | file. A vertical split is used. (also see |netrw-o|) |
| 768 | |
| 769 | |
| 770 | CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* |
| 771 | |
| 772 | One may "enter" a file with a special handler, thereby firing up a browser or |
| 773 | other application, for example, on a file by hitting the "x" key. Presumably |
| 774 | one could write handlers that would start OpenOffice programs (oowriter), etc, |
| 775 | based on the file's extension coupled with the user's hitting the "x" key atop |
| 776 | the file. |
| 777 | |
| 778 | The Netrw executor applies a user-defined function to a file, based on its |
| 779 | extension. Of course, the handler function must exist for it to be called! |
| 780 | > |
| 781 | Ex. mypgm.html x -> |
| 782 | NetrwFileHandler_html("scp://user@host/some/path/mypgm.html") |
| 783 | < |
| 784 | See the <plugin/NetrwFileHandlers.vim> for an example of how to handle an html |
| 785 | file with mozilla. |
| 786 | |
| 787 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 788 | MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* |
| 789 | |
| 790 | By default, g:netrw_keepdir is 0. This setting means that the current |
| 791 | directory will track the browsing directory. However, setting g:netrw_keepdir |
| 792 | to 1 (say, in your <.vimrc>) will keep the current directory independent |
| 793 | of the browsing directory. In that case, in order to make the two |
| 794 | directories the same, use the "c" map (just type c). |
| 795 | |
| 796 | |
| 797 | BOOKMARKING A DIRECTORY *netrw-b* |
| 798 | |
| 799 | One may easily "bookmark" a directory by using |
| 800 | |
| 801 | {cnt}b |
| 802 | |
| 803 | Any count may be used. |
| 804 | |
| 805 | |
| 806 | CHANGING TO A BOOKMARKED DIRECTORY *netrw-B* |
| 807 | |
| 808 | To change directory back to a bookmarked directory, use |
| 809 | |
| 810 | {cnt}B |
| 811 | |
| 812 | Any count may be used. |
| 813 | |
| 814 | |
| 815 | LISTING BOOKMARKS *netrw-q* |
| 816 | |
| 817 | Pressing "q" will list the bookmarked directories. (query) |
| 818 | |
| 819 | |
Bram Moolenaar | cfbc5ee | 2004-07-02 15:38:35 +0000 | [diff] [blame] | 820 | IMPROVING DIRECTORY BROWSING *netrw-list-hack* |
| 821 | |
| 822 | Especially with the remote directory browser, constantly entering the password |
| 823 | is tedious. |
| 824 | |
Bram Moolenaar | 843ee41 | 2004-06-30 16:16:41 +0000 | [diff] [blame] | 825 | For Linux/Unix systems, I suggest looking into |
| 826 | |
| 827 | http://hacks.oreilly.com/pub/h/66 |
| 828 | |
| 829 | It gives a tip for setting up password-less use of ssh and scp, and discusses |
| 830 | the associated security issues. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 831 | |
| 832 | |
| 833 | ============================================================================== |
| 834 | 8. Debugging *netrw-debug* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 835 | |
| 836 | The <netrw.vim> script is typically available as: |
| 837 | |
| 838 | /usr/local/share/vim/vim6x/plugin/netrw.vim |
| 839 | |
| 840 | which is loaded automatically at startup (assuming :set nocp). |
| 841 | |
| 842 | 1. Get the <Decho.vim> script, available as: |
| 843 | |
| 844 | http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts |
| 845 | as "Decho, a vimL debugging aid" |
| 846 | or |
| 847 | http://vim.sourceforge.net/scripts/script.php?script_id=120 |
| 848 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 849 | and put it into your local plugin directory. |
| 850 | |
| 851 | 2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need |
| 852 | to put it into your .vim/plugin, too. You may obtain it from: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 853 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 854 | http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs |
| 855 | as "DrC's Utilities" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 856 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 857 | 3. Edit the <netrw.vim> file by typing: |
| 858 | |
| 859 | vim netrw.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 860 | :DechoOn |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 861 | :wq |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 862 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 863 | To restore to normal non-debugging behavior, edit <netrw.vim> |
| 864 | by typing |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 865 | |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame^] | 866 | vim netrw.vim |
| 867 | :DechoOff |
| 868 | :wq |
| 869 | |
| 870 | This command, provided by <Decho.vim>, will comment out all |
| 871 | Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()). |
| 872 | |
| 873 | 4. Then bring up vim and attempt a transfer. A set of messages |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 874 | should appear concerning the steps that <netrw.vim> took in |
| 875 | attempting to read/write your file over the network. Please |
| 876 | send that information to <netrw.vim>'s maintainer, |
| 877 | |
| 878 | drchipNOSPAM at campbellfamily.biz - NOSPAM |
| 879 | |
| 880 | ============================================================================== |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 881 | 9. History *netrw-history* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 882 | |
Bram Moolenaar | 269ec65 | 2004-07-29 08:43:53 +0000 | [diff] [blame] | 883 | v47: * now handles local directory browsing. |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 884 | v46: * now handles remote directory browsing |
| 885 | * g:netrw_silent (if 1) will cause all transfers to be silent'd |
| 886 | v45: * made the [user@]hostname:path form a bit more restrictive |
| 887 | to better handle errors in using protocols |
| 888 | (e.g. scp:usr@host:file was being recognized as an rcp request) |
| 889 | v44: * changed from "rsync -a" to just "rsync" |
| 890 | * somehow an editing error messed up the test to recognize |
| 891 | use of the fetch method for NetRead. |
| 892 | * more debugging statements included |
| 893 | v43: * moved "Explanation" comments to <pi_netrw.txt> help file |
| 894 | as "Network Reference" (|netrw-ref|) |
| 895 | * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging |
| 896 | * removed superfluous NetRestorePosn() calls |
| 897 | v42: * now does BufReadPre and BufReadPost events on file:///* |
| 898 | and file://localhost/* |
| 899 | v41: * installed file:///* and file://localhost/* handling |
| 900 | v40: * prevents redraw when a protocol error occurs so that the |
| 901 | user may see it |
| 902 | v39: * sftp support |
| 903 | v38: * Now uses NetRestorePosn() calls with Nread/Nwrite commands |
| 904 | * Temporary files now removed via bwipe! instead of bwipe |
| 905 | (thanks to Dave Roberts) |
| 906 | v37: * Claar's modifications which test if ftp is successful, otherwise |
| 907 | give an error message |
| 908 | * After a read, the alternate file was pointing to the temp file. |
| 909 | The temp file buffer is now wiped out. |
| 910 | * removed silent from transfer methods so user can see what's |
| 911 | happening |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 912 | |
| 913 | |
| 914 | ============================================================================== |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 915 | 10. Credits *netrw-credits* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 916 | |
| 917 | Vim editor by Bram Moolenaar (Thanks, Bram!) |
| 918 | dav support by C Campbell |
| 919 | fetch support by Bram Moolenaar and C Campbell |
| 920 | ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM |
| 921 | http support by Bram Moolenaar <bram@moolenaar.net> |
| 922 | rcp |
| 923 | rsync support by C Campbell (suggested by Erik Warendorph) |
| 924 | scp support by raf <raf@comdyn.com.au> |
| 925 | sftp support by C Campbell |
| 926 | |
| 927 | inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell |
| 928 | |
| 929 | Jérôme Augé -- also using new buffer method with ftp+.netrc |
| 930 | Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,... |
| 931 | Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution |
| 932 | Erik Warendorph -- for several suggestions (g:netrw_..._cmd |
| 933 | variables, rsync etc) |
| 934 | Doug Claar -- modifications to test for success with ftp operation |
| 935 | |
| 936 | ============================================================================== |
| 937 | vim:tw=78:ts=8:ft=help:norl: |