Hidden config files
Source: Dotfiles: Best Way to Store in a Bare Git Repository
The technique consists in storing a Git bare repository in a "side" folder (like $HOME/.cfg or $HOME/.myconfig) using a specially crafted alias so that commands are run against that repository and not the usual .git local folder, which would interfere with any other Git repositories around.
Create bare repo + setup dotconfig
alias.
git init --bare $HOME/.cfg
alias dotconfig='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
dotconfig config --local status.showUntrackedFiles no
echo "alias dotconfig='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'" >> $HOME/.bashrc
From that point, use the dotconfig
alias as the git
command:
dotconfig status
dotconfig add .vimrc
dotconfig commit -m "Add vimrc"
dotconfig add .bashrc
dotconfig commit -m "Add bashrc"
dotconfig push
OSX uses by default zsh, but .zshrc
contains:
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
Hence, added to .bash_aliases
:
alias dotconfig='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
Source the configuration again:
source ~/.zshrc
Clone this repo into a bare version:
git clone --bare [email protected]:stijnme/dotfiles.git $HOME/.cfg
Checkout the bare repo into the current "workdir":
cd ~
dotconfig checkout
dotconfig config --local status.showUntrackedFiles no
- For
nvimtree
andnvim-web-devicons
a nerdfont is required (has extra icons included): Nerdfonts download - To use live grep in
Telescope
, the external toolripgrep
is required: Install ripgrep
sudo apt-get install ripgrep
- For certain tree-sitter parsers, the tree-sitter-cli is required (and should be added to
PATH
):
npm -g install tree-sitter-cli
After clonin the files in the .config/nvim
folder, start nvim
and execute following commands:
:PackerSync
To install the nvim packages with Packer. Next is launching Mason to install the necessary LSP, linter and formatting packages:
:Mason
nvim
config heavily inspired by Josean