@@ -125,6 +125,7 @@ call s:NetrwInit("g:netrw_rsync_cmd", "rsync")
125
125
call s: NetrwInit (" g:netrw_scp_cmd" , " scp -q" )
126
126
call s: NetrwInit (" g:netrw_sftp_cmd" , " sftp" )
127
127
call s: NetrwInit (" g:netrw_ssh_cmd" , " ssh" )
128
+ call s: NetrwInit (" g:netrw_dbx_cmd" , " dbx.py" )
128
129
129
130
if (has (" win32" ) || has (" win95" ) || has (" win64" ) || has (" win16" ))
130
131
\ && exists (" g:netrw_use_nt_rcp" )
@@ -954,6 +955,11 @@ fun! netrw#NetRead(mode,...)
954
955
let result = s: NetrwGetFile (readcmd, tmpfile, b: netrw_method )
955
956
let b: netrw_lastfile = choice
956
957
958
+ " NetRead: (Dropbox) NetRead Method #10 {{{3
959
+ elseif b: netrw_method == 10
960
+ exe s: netrw_silentxfer ." !" .g: netrw_dbx_cmd ." down " .shellescape (b: netrw_fname ,1 )." " .tmpfile
961
+ let result = s: NetrwGetFile (readcmd, tmpfile, b: netrw_method )
962
+ let b: netrw_lastfile = choice
957
963
" .........................................
958
964
" NetRead: Complain {{{3
959
965
else
@@ -1320,6 +1326,10 @@ fun! netrw#NetWrite(...) range
1320
1326
exe filtbuf." bw!"
1321
1327
let b: netrw_lastfile = choice
1322
1328
1329
+ " NetWrite: (Dropbox) NetWrite Method #10 {{{3
1330
+ elseif b: netrw_method == 10
1331
+ exe s: netrw_silentxfer ." !" .g: netrw_dbx_cmd ." up " .shellescape (b: netrw_fname ,1 )." " .tmpfile
1332
+ let b: netrw_lastfile = choice
1323
1333
" .........................................
1324
1334
" NetWrite: Complain {{{3
1325
1335
else
@@ -1572,6 +1582,7 @@ fun! s:NetrwMethod(choice)
1572
1582
let rsyncurm = ' ^rsync://\([^/]\{-}\)/\(.*\)\=$'
1573
1583
let fetchurm = ' ^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
1574
1584
let sftpurm = ' ^sftp://\([^/]\{-}\)/\(.*\)\=$'
1585
+ let dburm = ' ^dbx:///\(.*\)\=$'
1575
1586
1576
1587
" call Decho("determine method:")
1577
1588
" Determine Method
@@ -1665,6 +1676,11 @@ fun! s:NetrwMethod(choice)
1665
1676
endif
1666
1677
endif
1667
1678
1679
+ " Method#10: Get it from Dropbox
1680
+ elseif match (a: choice , dburm) == 0
1681
+ let b: netrw_method = 10
1682
+ let b: netrw_fname = substitute (a: choice ,dburm,' \1' ," " )
1683
+
1668
1684
" Method#8: fetch {{{3
1669
1685
elseif match (a: choice ,fetchurm) == 0
1670
1686
" call Decho("fetch://...")
@@ -1718,7 +1734,6 @@ fun! s:NetrwMethod(choice)
1718
1734
if userid != " "
1719
1735
let g: netrw_uid= userid
1720
1736
endif
1721
-
1722
1737
" Cannot Determine Method {{{3
1723
1738
else
1724
1739
if ! exists (" g:netrw_quiet" )
@@ -2510,7 +2525,7 @@ fun! s:NetrwBrowse(islocal,dirname)
2510
2525
" set b:netrw_curdir to the new directory name {{{3
2511
2526
" call Decho("set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")")
2512
2527
let b: netrw_curdir= dirname
2513
- if b: netrw_curdir = ~ ' [/\\]$'
2528
+ if b: netrw_curdir = ~ ' [/\\]$' && b: netrw_curdir !~ ' ^dbx:// '
2514
2529
let b: netrw_curdir= substitute (b: netrw_curdir ,' [/\\]$' ,' ' ,' e' )
2515
2530
endif
2516
2531
if b: netrw_curdir == ' '
@@ -2583,6 +2598,14 @@ fun! s:NetrwBrowse(islocal,dirname)
2583
2598
let dirname = substitute (dirname,' \\' ,' /' ,' g' )
2584
2599
" call Decho("(normal) dirname<".dirname.">")
2585
2600
endif
2601
+ " Check if the pattern matches a Dropbox URL.
2602
+ let dbxpat = ' ^dbx:///\(.*\)\='
2603
+ if dirname = ~ dbxpat
2604
+ keepj call s: NetrwMaps (a: islocal )
2605
+ keepj call s: PerformListing (a: islocal )
2606
+ let s: locbrowseshellcmd= 1
2607
+ return
2608
+ endif
2586
2609
2587
2610
let dirpat = ' ^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
2588
2611
if dirname !~ dirpat
@@ -3177,7 +3200,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...)
3177
3200
else
3178
3201
let dirpat= ' [\/]$'
3179
3202
endif
3180
- " call Decho("dirname<".dirname."> dirpat<".dirpat.">")
3181
3203
3182
3204
if dirname !~ dirpat
3183
3205
" apparently vim is "recognizing" that it is in a directory and
@@ -6837,7 +6859,13 @@ fun! s:NetrwRemoteListing()
6837
6859
keepj call histdel (" /" ,-1 )
6838
6860
endif
6839
6861
endif
6840
-
6862
+ " Dropbox directory listing
6863
+ elseif s: method == " dbx"
6864
+ if s: path == ' '
6865
+ exe " sil! keepalt r! " .g: netrw_dbx_cmd ." list /"
6866
+ else
6867
+ exe " sil! keepalt r! " .g: netrw_dbx_cmd ." list " .shellescape (s: path )
6868
+ endif
6841
6869
else
6842
6870
" use ssh to get remote file listing {{{3
6843
6871
" call Decho("use ssh to get remote file listing: s:path<".s:path.">")
@@ -8364,6 +8392,17 @@ endfun
8364
8392
fun ! s: RemotePathAnalysis (dirname)
8365
8393
" call Dfunc("s:RemotePathAnalysis(a:dirname<".a:dirname.">)")
8366
8394
8395
+ let dbxpat = ' ^dbx:///\(.*\)\='
8396
+ if a: dirname = ~ dbxpat
8397
+ let s: method = ' dbx'
8398
+ let s: user = ' '
8399
+ let s: machine = ' '
8400
+ let s: port = ' '
8401
+ let s: path = substitute (a: dirname ,dbxpat,' \1' ,' ' )
8402
+ let s: fname = ' '
8403
+ return
8404
+ endif
8405
+
8367
8406
let dirpat = ' ^\(\w\{-}\)://\(\w\+@\)\=\([^/:#]\+\)\%([:#]\(\d\+\)\)\=/\(.*\)$'
8368
8407
let s: method = substitute (a: dirname ,dirpat,' \1' ,' ' )
8369
8408
let s: user = substitute (a: dirname ,dirpat,' \2' ,' ' )
0 commit comments