sponsor Vim development Vim logo Vim Book Ad

advanced Tip #1385: Disable the "Hit any key to close this window" message in remote editing

 tip karma   Rating -1/3, Viewed by 388 

created:   November 13, 2006 7:44      complexity:   advanced
author:   Diomidis Spinellis      as of Vim:   6.0

When using the remote editing functionality under Microsoft Windows, vimrun.exe annoingly leaves an open window with the prompt "Hit any key to close this window". To disable this feature, modify in the vim plugins directory the file netrw.vim as follows:

--- netrw.vim.orig Mon Jun 07 15:06:24 2004
+++ netrw.vim Mon Nov 13 17:32:28 2006
@@ -342,10 +342,10 @@
    if g:netrw_cygwin == 1
     let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
"    call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile)
-    exe "!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile
+    silent exe "!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile
    else
"    call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
-    exe "!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
+    silent exe "!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
    endif
    let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
    let b:netrw_lastfile = choice
@@ -767,10 +767,10 @@
    if g:netrw_cygwin == 1
     let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
"    call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
-    exe "!".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
+    silent exe "! ".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
    else
"    call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
-    exe "!".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
+    silent exe "! ".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
    endif
    let b:netrw_lastfile = choice

 rate this tip  Life Changing Helpful Unfulfilling 

<<xterm256 color names for console vim. | Make Vim completion popup menu work just like in an IDE >>

Additional Notes

[email protected] - NOSPAM, November 13, 2006 11:56
IMHO, its much better to submit patches for netrw to me, directly.
Be that as it may, did you try  :let g:netrw_silent= 1  in your .vimrc?
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
    stats
Sponsored by Web Concept Group Inc. SourceForge.net Logo