0

I’m using SSH and Bash more and more. I continue to train with vim to improve automation. Customizing the configuration file ~/.vimrc greatly helps.

I am very interested in the question: Is it possible to automate the synchronization of .vimrc with a remote server via SSH session or other methods?

1
  • 1
    It's possible to send .vimrc to the remote server using scp, sftp, rsync, sshfs etc. You may automate it by keeping your .vimrc in the Git repository and creating a commit-hook that would deploy the new .vimrc on the remote server. Oct 11, 2020 at 11:43

1 Answer 1

1

As @arkadiusz-drabczyk already stated, there are many different ways to do that.

The probably easiest solution is scp ~/.vimrc USER@SERVER:PORT/home/USER/.vimrc to copy the local file to the remote machine.

But to keep them in sync it's recommended to use a version control system, since you might perform changes both locally and on the remote. This can be accomplished by either using a git repository and cloning it from a shared server (either a publicly available one like gitlab.com or similar) or from creating a bare git repository on the remote server you are connecting to and using this for sharing the files.

A more advanced way to do that is to utilize GNU Stow for dotfile management. But several other dotfile management tools exist next to GNU Stow, like rcm, yadm, homesick, homeshick, vcsh and several others (I'd recommend to take a look at the archwiki-page on that topic).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .