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