RSync on save in VIM

前端 未结 3 1395
猫巷女王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:16

    You can hook into BufWritePost. I don't remember the exact syntax, but ":he BufWritePost" and ":he autocommand" should help you.

    You setup a basic hook like this (pattern matches on a file, so you can do *.your_extension):

     :au BufWritePost * !rsync
    

    Also, there should be some way to make it buffer-local.

提交回复
热议问题