Vim sync to remote on save












1















I'm looking for a plugin or script that works similarly to Sublime SFTP

Basically, it should contain a configuration file and map the local and remote hierarchy.

On save to a file, it should be able to upload the changes to the remote accordingly.



Not familiar with writing Vim scripts so if that's achievable with scripts, hopefully its not too difficult to understand and modify. It should be flexible enough to be map different projects and not having to change the script each time we cd to a different project.



I did find the ftpsync plugin but it seems quite manual with no mention of config file.










share|improve this question























  • What OS do you use?

    – romainl
    Mar 24 '13 at 19:31











  • I'm using OS X.

    – resting
    Mar 24 '13 at 22:29
















1















I'm looking for a plugin or script that works similarly to Sublime SFTP

Basically, it should contain a configuration file and map the local and remote hierarchy.

On save to a file, it should be able to upload the changes to the remote accordingly.



Not familiar with writing Vim scripts so if that's achievable with scripts, hopefully its not too difficult to understand and modify. It should be flexible enough to be map different projects and not having to change the script each time we cd to a different project.



I did find the ftpsync plugin but it seems quite manual with no mention of config file.










share|improve this question























  • What OS do you use?

    – romainl
    Mar 24 '13 at 19:31











  • I'm using OS X.

    – resting
    Mar 24 '13 at 22:29














1












1








1








I'm looking for a plugin or script that works similarly to Sublime SFTP

Basically, it should contain a configuration file and map the local and remote hierarchy.

On save to a file, it should be able to upload the changes to the remote accordingly.



Not familiar with writing Vim scripts so if that's achievable with scripts, hopefully its not too difficult to understand and modify. It should be flexible enough to be map different projects and not having to change the script each time we cd to a different project.



I did find the ftpsync plugin but it seems quite manual with no mention of config file.










share|improve this question














I'm looking for a plugin or script that works similarly to Sublime SFTP

Basically, it should contain a configuration file and map the local and remote hierarchy.

On save to a file, it should be able to upload the changes to the remote accordingly.



Not familiar with writing Vim scripts so if that's achievable with scripts, hopefully its not too difficult to understand and modify. It should be flexible enough to be map different projects and not having to change the script each time we cd to a different project.



I did find the ftpsync plugin but it seems quite manual with no mention of config file.







vim






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 '13 at 18:14









restingresting

3911616




3911616













  • What OS do you use?

    – romainl
    Mar 24 '13 at 19:31











  • I'm using OS X.

    – resting
    Mar 24 '13 at 22:29



















  • What OS do you use?

    – romainl
    Mar 24 '13 at 19:31











  • I'm using OS X.

    – resting
    Mar 24 '13 at 22:29

















What OS do you use?

– romainl
Mar 24 '13 at 19:31





What OS do you use?

– romainl
Mar 24 '13 at 19:31













I'm using OS X.

– resting
Mar 24 '13 at 22:29





I'm using OS X.

– resting
Mar 24 '13 at 22:29










4 Answers
4






active

oldest

votes


















0














Vim comes wit the netrw plugin by default. It is a local/remote file explorer and you can read about it in :h netrw.



Basic usage looks like this:



:e scp://user@domain.ext/path/to/project/ " list content of remote directory
/filename<CR> " jump to filename
<cr> " open file for editing
(editing) " magic…
:w " save file remotely
:Rex " re-open latest file listing
rince, repeat…


Practically speaking, netrw works just like any other SFTP plugin/feature in any other editor/IDE: the file is downloaded, edited and saved locally and finally re-uploaded.



Netrw is quite a beast, though, I'd suggest you to read the doc carefully.



However…



…editing files directly on a remote server, either remotely via ssh or locally via (S)FTP, is not a very good idea. It can be slow and it's not particularily safe from a code quality point of view.



Assuming you are doing web development, a vastly better strategy is to run a development server on your own machine and only sync your files to a remote test server after you have tested everything locally.



That "syncing" part is usually handled most efficiently using a dedicated (S)FTP client GUI or CLI or, even better, a VCS like Subversion, Mercurial, Git or others.



As a web developer myself, I strongly encourage you to take the VCS route.






share|improve this answer


























  • Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

    – resting
    Mar 24 '13 at 22:34











  • No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

    – romainl
    Mar 25 '13 at 7:39



















0














I wrote a plugin for this purpose. It can be found here: https://github.com/hesselbom/vim-hsftp



It allows you to download or upload the current file through sftp.



It's in early stages but it has worked for my purposes and you're free to fork it or contribute if you'd like!






share|improve this answer































    0














    a vim plugin for syncing files over sftp can be found here






    share|improve this answer

































      0














      Or you can try this plugin that I wrote: https://github.com/cosminadrianpopescu/filesync.



      It works with anything that netrw supports (ftp, ssh, etc.).






      share|improve this answer


























      • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

        – DavidPostill
        Jan 14 '15 at 7:35











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f570853%2fvim-sync-to-remote-on-save%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Vim comes wit the netrw plugin by default. It is a local/remote file explorer and you can read about it in :h netrw.



      Basic usage looks like this:



      :e scp://user@domain.ext/path/to/project/ " list content of remote directory
      /filename<CR> " jump to filename
      <cr> " open file for editing
      (editing) " magic…
      :w " save file remotely
      :Rex " re-open latest file listing
      rince, repeat…


      Practically speaking, netrw works just like any other SFTP plugin/feature in any other editor/IDE: the file is downloaded, edited and saved locally and finally re-uploaded.



      Netrw is quite a beast, though, I'd suggest you to read the doc carefully.



      However…



      …editing files directly on a remote server, either remotely via ssh or locally via (S)FTP, is not a very good idea. It can be slow and it's not particularily safe from a code quality point of view.



      Assuming you are doing web development, a vastly better strategy is to run a development server on your own machine and only sync your files to a remote test server after you have tested everything locally.



      That "syncing" part is usually handled most efficiently using a dedicated (S)FTP client GUI or CLI or, even better, a VCS like Subversion, Mercurial, Git or others.



      As a web developer myself, I strongly encourage you to take the VCS route.






      share|improve this answer


























      • Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

        – resting
        Mar 24 '13 at 22:34











      • No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

        – romainl
        Mar 25 '13 at 7:39
















      0














      Vim comes wit the netrw plugin by default. It is a local/remote file explorer and you can read about it in :h netrw.



      Basic usage looks like this:



      :e scp://user@domain.ext/path/to/project/ " list content of remote directory
      /filename<CR> " jump to filename
      <cr> " open file for editing
      (editing) " magic…
      :w " save file remotely
      :Rex " re-open latest file listing
      rince, repeat…


      Practically speaking, netrw works just like any other SFTP plugin/feature in any other editor/IDE: the file is downloaded, edited and saved locally and finally re-uploaded.



      Netrw is quite a beast, though, I'd suggest you to read the doc carefully.



      However…



      …editing files directly on a remote server, either remotely via ssh or locally via (S)FTP, is not a very good idea. It can be slow and it's not particularily safe from a code quality point of view.



      Assuming you are doing web development, a vastly better strategy is to run a development server on your own machine and only sync your files to a remote test server after you have tested everything locally.



      That "syncing" part is usually handled most efficiently using a dedicated (S)FTP client GUI or CLI or, even better, a VCS like Subversion, Mercurial, Git or others.



      As a web developer myself, I strongly encourage you to take the VCS route.






      share|improve this answer


























      • Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

        – resting
        Mar 24 '13 at 22:34











      • No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

        – romainl
        Mar 25 '13 at 7:39














      0












      0








      0







      Vim comes wit the netrw plugin by default. It is a local/remote file explorer and you can read about it in :h netrw.



      Basic usage looks like this:



      :e scp://user@domain.ext/path/to/project/ " list content of remote directory
      /filename<CR> " jump to filename
      <cr> " open file for editing
      (editing) " magic…
      :w " save file remotely
      :Rex " re-open latest file listing
      rince, repeat…


      Practically speaking, netrw works just like any other SFTP plugin/feature in any other editor/IDE: the file is downloaded, edited and saved locally and finally re-uploaded.



      Netrw is quite a beast, though, I'd suggest you to read the doc carefully.



      However…



      …editing files directly on a remote server, either remotely via ssh or locally via (S)FTP, is not a very good idea. It can be slow and it's not particularily safe from a code quality point of view.



      Assuming you are doing web development, a vastly better strategy is to run a development server on your own machine and only sync your files to a remote test server after you have tested everything locally.



      That "syncing" part is usually handled most efficiently using a dedicated (S)FTP client GUI or CLI or, even better, a VCS like Subversion, Mercurial, Git or others.



      As a web developer myself, I strongly encourage you to take the VCS route.






      share|improve this answer















      Vim comes wit the netrw plugin by default. It is a local/remote file explorer and you can read about it in :h netrw.



      Basic usage looks like this:



      :e scp://user@domain.ext/path/to/project/ " list content of remote directory
      /filename<CR> " jump to filename
      <cr> " open file for editing
      (editing) " magic…
      :w " save file remotely
      :Rex " re-open latest file listing
      rince, repeat…


      Practically speaking, netrw works just like any other SFTP plugin/feature in any other editor/IDE: the file is downloaded, edited and saved locally and finally re-uploaded.



      Netrw is quite a beast, though, I'd suggest you to read the doc carefully.



      However…



      …editing files directly on a remote server, either remotely via ssh or locally via (S)FTP, is not a very good idea. It can be slow and it's not particularily safe from a code quality point of view.



      Assuming you are doing web development, a vastly better strategy is to run a development server on your own machine and only sync your files to a remote test server after you have tested everything locally.



      That "syncing" part is usually handled most efficiently using a dedicated (S)FTP client GUI or CLI or, even better, a VCS like Subversion, Mercurial, Git or others.



      As a web developer myself, I strongly encourage you to take the VCS route.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Mar 24 '13 at 20:15

























      answered Mar 24 '13 at 20:00









      romainlromainl

      17.8k23245




      17.8k23245













      • Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

        – resting
        Mar 24 '13 at 22:34











      • No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

        – romainl
        Mar 25 '13 at 7:39



















      • Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

        – resting
        Mar 24 '13 at 22:34











      • No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

        – romainl
        Mar 25 '13 at 7:39

















      Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

      – resting
      Mar 24 '13 at 22:34





      Hmm... am using Mercurial. So my workflow is edit local files, sync to remote for testing (cause there's some hardware not available locally), if everything's good, commit and push locally to repo. I'm not sure using Mercurial as a mean to "sync" is a good idea cause then I have to commit and push every single test.

      – resting
      Mar 24 '13 at 22:34













      No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

      – romainl
      Mar 25 '13 at 7:39





      No, that's not a good idea indeed but you didn't give the whole picture. What kind of hardware do you need that makes it impossible to test your code locally? Anyway, you should use a GUI FTP program like Transmit or YummyFTP or Interarchy… they all have the kind of "watch folder"-like feature that you want. No need to pollute your text editor.

      – romainl
      Mar 25 '13 at 7:39













      0














      I wrote a plugin for this purpose. It can be found here: https://github.com/hesselbom/vim-hsftp



      It allows you to download or upload the current file through sftp.



      It's in early stages but it has worked for my purposes and you're free to fork it or contribute if you'd like!






      share|improve this answer




























        0














        I wrote a plugin for this purpose. It can be found here: https://github.com/hesselbom/vim-hsftp



        It allows you to download or upload the current file through sftp.



        It's in early stages but it has worked for my purposes and you're free to fork it or contribute if you'd like!






        share|improve this answer


























          0












          0








          0







          I wrote a plugin for this purpose. It can be found here: https://github.com/hesselbom/vim-hsftp



          It allows you to download or upload the current file through sftp.



          It's in early stages but it has worked for my purposes and you're free to fork it or contribute if you'd like!






          share|improve this answer













          I wrote a plugin for this purpose. It can be found here: https://github.com/hesselbom/vim-hsftp



          It allows you to download or upload the current file through sftp.



          It's in early stages but it has worked for my purposes and you're free to fork it or contribute if you'd like!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 11 '13 at 12:31









          hesselbomhesselbom

          1012




          1012























              0














              a vim plugin for syncing files over sftp can be found here






              share|improve this answer






























                0














                a vim plugin for syncing files over sftp can be found here






                share|improve this answer




























                  0












                  0








                  0







                  a vim plugin for syncing files over sftp can be found here






                  share|improve this answer















                  a vim plugin for syncing files over sftp can be found here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Oct 16 '13 at 16:27









                  MariusMatutiae

                  38.3k95297




                  38.3k95297










                  answered Oct 16 '13 at 15:30









                  eshioneshion

                  1




                  1























                      0














                      Or you can try this plugin that I wrote: https://github.com/cosminadrianpopescu/filesync.



                      It works with anything that netrw supports (ftp, ssh, etc.).






                      share|improve this answer


























                      • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                        – DavidPostill
                        Jan 14 '15 at 7:35
















                      0














                      Or you can try this plugin that I wrote: https://github.com/cosminadrianpopescu/filesync.



                      It works with anything that netrw supports (ftp, ssh, etc.).






                      share|improve this answer


























                      • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                        – DavidPostill
                        Jan 14 '15 at 7:35














                      0












                      0








                      0







                      Or you can try this plugin that I wrote: https://github.com/cosminadrianpopescu/filesync.



                      It works with anything that netrw supports (ftp, ssh, etc.).






                      share|improve this answer















                      Or you can try this plugin that I wrote: https://github.com/cosminadrianpopescu/filesync.



                      It works with anything that netrw supports (ftp, ssh, etc.).







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 13 '15 at 22:06









                      Excellll

                      11.1k74162




                      11.1k74162










                      answered Jan 13 '15 at 21:40









                      Cosmin PopescuCosmin Popescu

                      1




                      1













                      • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                        – DavidPostill
                        Jan 14 '15 at 7:35



















                      • Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                        – DavidPostill
                        Jan 14 '15 at 7:35

















                      Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                      – DavidPostill
                      Jan 14 '15 at 7:35





                      Please quote the essential parts of the answer from the reference link(s), as the answer can become invalid if the linked page(s) change.

                      – DavidPostill
                      Jan 14 '15 at 7:35


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f570853%2fvim-sync-to-remote-on-save%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      How to make a Squid Proxy server?

                      Is this a new Fibonacci Identity?

                      19世紀