Skip to content

lethang7794/dotfiles

Repository files navigation

My dotfiles

gitleaks

What is this repo?

This repo is for storing my public config files, canonically called dotfiles.

Tip

This is my first attempt to have experiences with

  • Linux (especially Fedora)
  • Configuration as Code

Caution

The configurations may not apply best practices because I don't have much experiences with Linux.

(I switched to Linux one year ago, after more than one year with MacOS, and before that is only Windows)

Intro

The dotfiles are

Get started

Use this repo as starting point for your dotfiles

To apply the dotfiles in this repo to a new machine, run:

alias dotty='GIT_WORK_TREE=~ GIT_DIR=~/.dotfiles'
alias dotfiles='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'

git clone --bare git@github.com:lethang7794/dotfiles $HOME/.dotfiles
dotfiles config --local status.showUntrackedFiles no

dotfiles checkout
if [[ $? == 0 ]]; then
  echo "Checked out dotfiles.";
else
  echo "Backing up pre-existing dot files.";
  dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} mv {} .dotfiles.bak/{}
fi

Note

After running this, you have:

  • $HOME/.dotfiles: The bare repo (of this remote repository) with only the .git directory.
  • $HOME: Acts as a worktree of that bare repo.

See

Working with dotfiles

Using the CLI

Note

Instead of using git (git add, git commit...),

  • you use dotfiles (dotfiles add, dotfiles commit...)
  • Add changes files to the index (of local repo)

    dotfiles add path/to/file
  • Commit files to the local repo

    dotfiles commit -m "message"
  • Push commit to remote repo (this repo)

    dotfiles push
    

References

Chezmoi

How chezmoi works?

chezmoi concepts

Destination Dir Source Dir Target
What is it? The directory that chezmoi manages Where chezmoi stores the source state a file, directory, or symlink in the destination directory
Example ~ ~/.local/share/chezmoi (temporary file)
Destination State Source State Target State
What is it? Current state of all the targets in the destination directory Desired state of your home directory Desired state of the destination directory.
Example ~/.zshrc ~/.local/share/chezmoi/dot_zshrc /tmp/chezmoi-merge1615707743/.zshrc

How chezmoi apply the state to each target?

  1. Read the source state.

  2. Read the destination state.

  3. Compute the target state.

  4. Run run before scripts in alphabetical order.

  5. Update entries in the target state (files, directories, externals, scripts, symlinks, etc.) in alphabetical order of their target name.

    Directories (including those created by externals) are updated before the files they contain.

  6. Run run after scripts in alphabetical order.

Config references
Where is the config? Configuration structure Docs
broot ~/.config/broot conf.hjson: Config https://dystroy.org/broot/conf_file/
verbs.hjson: Keyboard shortcut https://dystroy.org/broot/conf_verbs/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published