gpt4 book ai didi

git - 如何在 Github 中存储 Sublime Text 首选项

转载 作者:太空狗 更新时间:2023-10-29 13:10:45 27 4
gpt4 key购买 nike

我全天使用几台不同的机器,我使用 git 来下载我项目中的最新代码。

但是,我的 Sublime Text 安装在每台机器上都是不同的,我无法保持我的包正确无误。我的 Sublime Text 3 首选项/包存储在 ~/Library/Application Support/Sublime Text 3 中。

有没有办法将我的首选项存储在 Github 中,以便我可以将它们 pull 到其他机器上?我对这样做感到紧张,想知道以前是否有其他人这样做过。 p>

最佳答案

存储包控制/用户

您只需要添加 ~/Library/Application Support/Sublime Text 3/Package Control/User/(或在 Windows 上:C:\Users\{username}\AppData\Roaming\Sublime Text 3\Packages\User) 目录。

来自 https://packagecontrol.io/docs/syncing

The proper solution is to install Package Control on all machines and then to sync only the Packages/User/ folder. This folder contains the Package Control.sublime-settings file, which includes a list of all installed packages. If this file is copied to another machine, the next time Sublime Text is started, Package Control will install the correct version of any missing packages.

设置步骤

在 github 上创建一个新的 repo,将其命名为“sublime-prefs”,然后运行这些命令:

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
git init
git add Package\ Control.sublime-settings
git commit -am "settings from from <device name>"
git remote add origin https://github.com/<github name>/<repo name>.git
git push -u origin master

下 pull 到其他机器...

退出 Sublime Text 3,然后运行这些命令(使用来自 How do I clone into a non-empty directory? 的答案):

cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
git init
git remote add origin https://github.com/<github name>/<repo name>.git
rm Package\ Control.sublime-settings
git fetch
git checkout -t origin/master

关于git - 如何在 Github 中存储 Sublime Text 首选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38710121/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com