[vim/vim] gvim netrw windows g:netrw_scp_cmd - transparent remote file editing does not work over scp (#3762)

27 views
Skip to first unread message

Joachim

unread,
Jan 4, 2019, 12:30:58 PM1/4/19
to vim/vim, Subscribed

Hi,

I've finally found out that netrw replaces colon with slash in path to a temporary file and inserts slash at the beginning of the path. Consequently, the content of remote file cannot be copied to local temporary copy over scp on windors.

Path to temporary file (tmpfile) is modified here:

https://github.com/vim/vim/blob/7f1664e392388fd38c8b154389167ad1bdedff66/runtime/autoload/netrw.vim#L2101-L2103

I have no idea when the path substitution helps but it may be really annoying when you use scp utility and its directory is added to PATH environmental variable.

let g:netrw_scp_cmd  = 'scpg3.exe -q' " Tectia Client

Workaround

It works when you undo substitutions in temporary file path.
Insert this line in autoload/netrw.vim file in if statement after substitution.

let tmpfile_get = tmpfile

but it's probably better to modify the condition in if statement...


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Lirian Su

unread,
Dec 22, 2019, 12:13:55 AM12/22/19
to vim/vim, Subscribed

Same issue here.

Reproducing:

  1. Run :edit scp://host//linux_path
  2. Vim will run scp /linux_path /windows_path
  3. But windows path is substituted, which is something like /C/Users/me/AppData/Local/Temp/nonce.file


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Lirian Su

unread,
Dec 22, 2019, 12:16:56 AM12/22/19
to vim/vim, Subscribed

Another workaround is change:

https://github.com/vim/vim/blob/7f1664e392388fd38c8b154389167ad1bdedff66/runtime/autoload/netrw.vim#L2101-L2103

To:

 if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16")) && !has("gui_running")
   let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '') 
 else 


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

EdwinWenink

unread,
Dec 20, 2022, 11:36:35 AM12/20/22
to vim/vim, Subscribed

Encountered this exact issue on Windows, LKI's solution worked for me. Is there a way to solve this without editing autoload/netrw.vim? For example, is there a way to apply this hotfix from my user's vim configuration so I can put it under version control?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3762/1359692711@github.com>

Christian Brabandt

unread,
Dec 20, 2022, 12:13:13 PM12/20/22
to vim/vim, Subscribed

ping @cecamp


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3762/1359786054@github.com>

EdwinWenink

unread,
Dec 20, 2022, 12:16:28 PM12/20/22
to vim/vim, Subscribed

The discussion at #5199 seems to be related


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/3762/1359801833@github.com>

Reply all
Reply to author
Forward
0 new messages