RSync on save in VIM

前端 未结 3 1418
猫巷女王i
猫巷女王i 2021-02-06 11:00

I\'m looking for a way to map the :w command so that when I use it, it will rsync the current directory and save the file in question. Ideally, the response generated by the rsy

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-06 11:20

    If you want to keep the local copy, then the BufWritePost autocmd suggested by viraptor is the best bet, but assuming you have the netrw plugin installed (part of the default Vim runtime files), you can also start vim with:

    vim rsync://myrsync_server.com/path
    

    and just edit the file as if it's local: saves will update the remote server.

    :help rsync
    

提交回复
热议问题