Last active
April 15, 2020 15:49
-
-
Save steve10287/63e337f19bc2dec6681a18ace3563c39 to your computer and use it in GitHub Desktop.
Vim SCP on save
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
" scp config | |
let g:enable_scp = 1 | |
let g:scp_server = "server_ip" | |
let g:scp_user = "server_username" | |
let g:scp_remote = "remote_path" | |
let g:scp_local = "local_path" | |
let g:scp_build_local_path = "local_build_folder" | |
let g:scp_build_remote_path = "remote_build_folder" |
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
set exrc | |
set secure | |
" scp | |
function RemoteSync () | |
if !exists("g:enable_scp") || g:enable_scp == 0 | |
return | |
endif | |
let filename = expand("%:p") | |
let dest = substitute(filename, g:scp_local, g:scp_remote, "") | |
exec ":silent !scp -q '" . filename . "' '" . g:scp_user . "@" . g:scp_server . ":" . dest . "'" | |
let build_dest = g:scp_remote . "/" . g:scp_build_remote_path | |
let build_source = g:scp_local . "/" . g:scp_build_local_path | |
exec ":silent !scp -r -q '" . build_source . "' '" . g:scp_user . "@" . g:scp_server . ":" . build_dest . "'" | |
endfunction | |
au BufWritePost,FileWritePost * silent call RemoteSync() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment