From 4e071727cd1f00862d1a0471fd2d9c10ab9ebff8 Mon Sep 17 00:00:00 2001 From: SANGHYUN RYU Date: Fri, 22 Feb 2019 14:21:43 +0900 Subject: [PATCH] feat(vim-hsftp): Add auto sync options --- plugin/hsftp.vim | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugin/hsftp.vim b/plugin/hsftp.vim index a20ee23..8bd739c 100644 --- a/plugin/hsftp.vim +++ b/plugin/hsftp.vim @@ -134,3 +134,11 @@ command! Hupdir call H_UploadFolder() nmap hsd :Hdownload nmap hsu :Hupload nmap hsf :Hupdir + +let conf = H_GetConf() +if has_key(conf, 'host') && conf['auto_upload'] == 1 + autocmd BufWritePost * if expand('%:t') != '.hsftp' | :call H_UploadFile() +endif +if has_key(conf, 'host') && conf['auto_download'] == 1 + autocmd BufReadPre * if expand('%:t') != '.hsftp' |:call H_DownloadFile() +endif