Vim's Practical Tips series-use Baidu cloud and git to configure multi-machine sharing for VIM

Source: Internet
Author: User
Tags git client

Vim is a powerful text editor. A good configuration facilitates the use of vim. Sometimes, we use VIM on several different computers. For example, we may have vim installed on both our own computers and our company's computers. Sometimes, we need to implement, if we configure one of the VIM environment, we can easily copy these configurations to another machine, even if we update one of the machines and even a few machines configuration, it can be easily synchronized to other machines. Fortunately, there are more options for cloud storage now. With them, plus a version control software, we can do this easily.

In this article, the author chose the Baidu Cloud as the cloud storage, and version control, then chose Git. This article is for gvim under Windows.

First, we need to install Baidu Cloud Sync disk and git client on each machine

Baidu Cloud Sync Disk: Http://pan.baidu.com/download

Git client: http://www. git-scm.com/downloads

Second, on each machine, we need the following directory structure

Vim folder: Refers to the directory where Vim is installed.

Cloud Disk folder: Refers to the synchronization in the Baidu disk specified in the local sync directory.

Third, if Git is not configured, run GIT bash and configure Git as follows. Similarly, for a cloud synchronization disk, you also specify a local synchronization directory.

git config--global user.name "your name"
git config--global user.email "your email"

Four, on any machine, do the following to create the Vim configuration file warehouse

1. Run git bash and execute the following command to create a directory in the Cloud sync disk

CD Cloud Disk folder (for example,/c/yundisk/gitrepositories/)
mkdir vim
CD VIM
Git init--bare

2. Run GIT bash with administrator privileges and execute the following command to add the Vim profile to version control

CD Vim folder (for example, "/c/program Files (x86)/vim")
Git init
git add _VIMRC
Git commit-m "first version."
Git remote Add Origin Cloud Disk folder (for example,/c/yundisk/gitrepositories/)
Git push-u Origin Master

At this point, we have added the local vim profile to version control and synced to the Cloud sync disk.

V, on other machines, do the following to synchronize the Vim profile in the Cloud sync disk into the Vim folder

Run GIT bash with administrator privileges and execute the following command

CD Vim folder (for example, "/c/program Files (x86)/vim")
git Clone Cloud Disk folder (for example,/c/yundisk/gitrepositories/)
Git remote Add Origin Cloud Disk folder (for example,/c/yundisk/gitrepositories/)
Git pull Origin Master

Until now, all of the Vim profiles on all machines have been added to version control and have been synchronized

VI, when you modify the VIM configuration on any one of the machines, do the following to sync it to the Cloud sync disk

Run GIT bash with administrator privileges and execute the following command to add a VIM profile to version control

CD Vim folder (for example, "/c/program Files (x86)/vim")
git add _VIMRC
Git commit-m "your comments."
Git pull Origin master//Synchronize updates of other machines to this machine first, if there is a conflict, to handle conflicts
Git push origin master//submit native updates

VII, for other machines, do the following to synchronize these updates

Run GIT bash with administrator privileges and execute the following command to add a VIM profile to version control

CD Vim folder (for example, "/c/program Files (x86)/vim")
Git pull Origin Master

At this point, we can synchronize the vim configuration file on all of our machines.

Vim's Practical Tips series-use Baidu cloud and git to configure multi-machine sharing for VIM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.