An open API service indexing awesome lists of open source software.

https://github.com/kingnobro/dotfiles


https://github.com/kingnobro/dotfiles

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# My Public Dotfiles

This repository contains public dotfiles including various configuration files, shell utilies, plugins, etc (i.e. dotfiles). There is also a private repository containing private dotfiles like ssh info.

I'm using [Dotbot](https://github.com/anishathalye/dotbot) to manage dotfiles. [Tutorial](https://www.anishathalye.com/2014/08/03/managing-your-dotfiles/) on Dotbot by [Anish](https://www.anishathalye.com/) (the author, also one of the lecturers of [MIT-Missing-Semester](https://missing.csail.mit.edu/)).

There are many different approaches other than Dotbot, see https://dotfiles.github.io/

## Note

- zsh plugins are not placed in default folder (`$ZSH/custom`), but in `ZSH_CUSTOM="$HOME/.zsh/custom"`. The default position is inside oh-my-zsh repo, causing repos (omz vs plugins) nesting with each other and hard to maintain in dotbot (clone order, dirty repo and other problems). If there is a better way, please let me know.
- conda
- `conda init` shoud be placed in `~/.shell_local_after`. This is now automated by assuming `conda init zsh` append 15 lines to `~/.zshrc`.
- assuming conda envs are installed in `~/.conda`, use `conda_pull` to rsync from remote.
- vscode settings are not maintain by dotfiles, vscode has its own way to sync its [settings](https://code.visualstudio.com/docs/editor/settings-sync).
- If you are working with vscode remote, basically you don't need to sync your settings because you settings is used on remote [by default](https://code.visualstudio.com/docs/remote/ssh#_ssh-hostspecific-settings), but you should [specify what extensions to install on remote](https://code.visualstudio.com/docs/remote/ssh#_always-installed-extensions) for that extensions are not automatically installed on remote.
- tmux:
- [oh-my-tmux](https://github.com/gpakosz/.tmux#bindings)
- using Fira Font as powerline font for tmux

## Cheat Sheet

### Sync all dotfiles to a new machine

First, [generate new ssh key](https://docs.github.com/cn/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent) and [add it to github](https://docs.github.com/cn/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account) (more instructions [here](https://github.com/calvinbui/dotfiles)). Then, clone and install dotfiles.

```bash
git clone git@github.com:kingnobro/dotfiles.git
cd dotfiles
./install
```

### Modify dotfiles

Add a new dotfile `~/.foo` :

```bash
mv ~/.foo ~/.dotfiles/foo
# Add a new link for `foo` in install.conf.yaml
~/.dotfiles/install
# commit changes to git
```

Add a git submodule (eg. plugins) `~/vim/foo` :

```bash
cd ~/.dotfiles
mkdir -p vim # make parent directory
# If submodule is already cloned to there, rm -rf it first
git submodule add ${git_link_to_foo} vim/foo # add submodule, specify path explicitly
# Add a new link for `vim` in install.conf.yaml
# commit changes to git
```

Delete all dotfiles installed by this repo:

```bash
./uninstall
```

Upgrade all submodules:

```bash
git submodule update --recursive --remote
# commit changes
# on another machine, run dfu, that is:
git pull
./install # the key is: git submodule sync --recursive
```

## My Tricks

If a directory is managed by both public and private Dotbot repos(eg. `~/.ssh`, `~/.config` etc.), then you can't directly symlink the directory due to conflict. The solution is to link each file in these directories, explicitly or using wildcard(glob).

## TODO

Extra initialization steps after `./install` . They are not yet covered by Dotbot, still working on it to automate.

- tldr
- submodule init shoud be placed before file mapping