I am using git submodules and git bare repository to maintain my dotfiles.
alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
# You used to need this, but not anymore
# echo "dotfiles" >> .gitignore
git clone --bare https://github.com/svaderia/dotfiles $HOME/dotfiles
# Checkout config from bare repository to home
# if you get error, take backup of all the files
config checkout
config config --local status.showUntrackedFiles no
# When you are first initialising the submodules on a new system, run below command
config submodule update --init --recursive
# If you are on linux/windows, you will need install ZSH Separetly.
# Please follow the instructions from here:
# https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH
# make sure to make it a default shell
# Reload the shell before doing below
# Don't forget to change the local_profile.zsh and local_alias.zsh to set the new paths
cp $ZSH_CUSTOM/setup.zsh.example $ZSH_CUSTOM/00-setup.zsh
touch $ZSH_CUSTOM/02-local_profile.zsh
touch $ZSH_CUSTOM/04-local_alias.zsh
# Optional
## Use following to update your git name and email
## TODO: This can be moved to a global variable in profile.zsh
git config --global user.name "svaderia"
git config --global user.email "<email>"
git config --global credential.helper store
git config --global core.editor vim
- https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key
- https://docs.github.com/en/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key
config submodule update --remote --merge
# create the undodir for the .vim
mkdir -p ~/.vim/undodir
config submodule deinit .vim/pack/bundle/start/vim-airline
config rm .vim/pack/bundle/start/vim-airline
rm -Rf .git/modules/.vim/pack/bundle/start/vim-airline
config commitconfig submodule add https://github.com/kana/vim-textobj-user ~/.vim/pack/bundle/start/vim-textobj-user
# Commit it
config add .gitmodule ~/.vim/pack/bundle/start/vim-textobj-user
config commitSwap git submodule with own fork Replace a submodule of a forked repository
config submodule set-url -- .vim/pack/bundle/start/vim-textobj-function https://github.com/svaderia/vim-textobj-function
# Now go to directory
git fetch
git checkout <your-branch>
git pull
config add .
config commitIf you are trying to install on linux, where you have sudo access, then install brew first and then install the tools via brew.
Simple reason for this is fzf does not maintain active latest packages in APT package manage.
Install brew first as below:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Now run following commands:
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $ZSH_CUSTOM/02-local_profile.zshIf you don't have sudo on a linux machine, do following:
git clone https://github.com/Homebrew/brew ~/.linuxbrew
eval "$(~/.linuxbrew/bin/brew shellenv)"
brew update --force --quiet
chmod -R go-w "$(brew --prefix)/share/zsh"
You can otherwise install it manually as well. Brew can also be installed without root priviledges, see the installation instructions of brew.
brew install fzf ripgrep fd