Created
March 31, 2011 02:16
-
-
Save takeshy/895706 to your computer and use it in GitHub Desktop.
vim scp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" You should execute pagent before you call those command. | |
function PutScp() | |
let s:nowDir = substitute(expand("%:p:h"),"[cC]:\\(.*\\)$","\\1","") | |
let s:nowFile = expand("%:t") | |
let s:fn = "c:\\tmp\\scpcmd.txt" | |
if filereadable(s:fn) | |
let s:ret = delete(s:fn) | |
endif | |
execute "sp ".s:fn | |
call LineAdd("option batch on") | |
call LineAdd("open USER_NAME@SERVER_ADDRESS") | |
call LineAdd("cd ".s:nowDir) | |
call LineAdd("rm \"".s:nowFile."\"") | |
call LineAdd("put \"".s:nowFile."\"") | |
call LineAdd("exit") | |
execute "w" | |
execute "q" | |
execute "!start \"C:\\Program\ Files\ (x86)\\WinSCP\\winscp.exe\" /console /script=\"c:\\tmp\\scpcmd.txt\"" | |
endfunction | |
function GetScp() | |
let s:nowDir = substitute(expand("%:p:h"),"[cC]:/\\(.*\\)$","\\1","") | |
let s:nowFile = expand("%:t") | |
let s:fn = "c:\\tmp\\scpcmd.txt" | |
if filereadable(s:fn) | |
let s:ret = delete(s:fn) | |
endif | |
execute "sp ".s:fn | |
call LineAdd("option batch on") | |
call LineAdd("open USER_NAME@SERVER_NAME") | |
call LineAdd("cd " . s:nowDir) | |
call LineAdd("get \"".s:nowFile."\"") | |
call LineAdd("exit") | |
execute "w" | |
execute "q" | |
call rename(s:nowFile,s:nowFile . ".bk") | |
execute "!start \"C:\\Program\ Files\ (x86)\\WinSCP\\winscp.exe\" /console /script=\"c:\\tmp\\scpcmd.txt\"" | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment