Version control for my dotfiles.
You can use this repo in one of two ways:
- Check out my dotfiles for inspiration.
- Clone this repo into your home directory and run the
bootstrap.sh
script to set up symlinks to these dotfiles. This way you can version control just the dotfiles
Dotfiles allow you to customize your shell. When setting up a new machine it's nice to have all that config come with you. Hence we want to version control our dotfiles. The challenge is that these dotfiles are expected to live in a certain place on your machine. Typically your dotfiles have the following structure:
~/
.bashrc
.zshrc
.gitconfig
.tmux.conf
...
Now we can't reasonably version control all of ~
! There's a neat trick that gets around this. Clone dotfiles
to ~ and use symlinks to reference them.
~/
.bashrc -> ~/dotfiles/.bashrc
...
dotfiles/
.bashrc
...
This will redirect all requests for ~/.bashrc
to ~/dotfiles/.bashrc
(and so on), meaning that things will still work as expected. And now we can version control ~/dotfiles
and the problem is solved.
Setting up a new machine for the first time:
# set up ssh
ssh-keygen -t rsa
less ~/.ssh/id_rsa.pub
#! manual step:
# copy ssh id to your github account
cd ~
git clone [email protected]:aminsaied/dotfiles.git
cd dotfiles
bash bootstrap.sh
Note. Running sudo bash bootstrap.sh
will treat ~ directory as /root
, not /home/<user>
.
Goal: Use ssh-agent to forward ssh keys from my client (e.g. my laptop) to the server (e.g. some azure vm). This allows you to interact with github using your client ssh keys from the remote.
On client:
- My
.zshrc
starts up an agent and adds the ssh keys. Note: since I am using WSL I need to do this manually for each new shell, hence putting this in.zshrc
. TODO: add this to.profile
.
For new VM:
-
Configure the VM in
~/.ssh/config
includingForwardAgent yes
to enable agent forwarding.Host amsaied-ci HostName 52.250.36.122 User azureuser Port 50000 ForwardAgent yes
Note. Alternatively, use
-A
flag with ssh:ssh -A user@example
You'll need this repo cloned into oh-my-zsh's plugins directory e.g. like this:
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Note - you may get a security warning about plugins. The warning will give you some options to address this.
Broot is better way to navigate directories from your shell.
Download broot tool from here. There are a number of download options, do this one for Ubuntu on WSL:
- Download from pre-compiled binaries (target=Linux)
- This will place the executable file
broot
somewhere likeC:\Users\<USER-NAME>\Downloads\broot
- Move this to
/usr/local/bin
withsudo mv /mnt/c/Users/<USER-NAME>/Downloads/broot /usr/local/bin/
- Set
broot
to be executable withchmod +x broot
- Finally, attempt to run
broot
and you will be met with the prompt to download https://github.com/Canop/broot. In particular, this will write thebr
shell function in/home/<user>/.local/share/broot/launcher/bash/1
which is referenced in the.zshrc
config.
Note. WSL has a keybinding assigned to Alt
+Enter
(toggles fullscreen) which conflicts with a vital command in broot: change directory. You can delete the WSL keybinding from settings > actions.
Install / set up miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
rm -f Miniconda3-latest-Linux-x86_64.sh
You'll be prompted to answer some questions as part of the Miniconda install process. Nothing too taxing, I promise ;-)
I've included my settings for Windows Terminal. Unfortunately there is no magic syncing here, just meant for inspiration. You can edit your settings directly from the windows terminal by selecting "Settings" from the drop down menu.
To get YCM plugin installed need to run:
sudo apt install build-essential cmake
Then change directory to the YCM plugin and run the install script
cd ~/.vim/plugged/YouCompleteMe
python3 install.py
TODO: add this to the bootstrap.sh
script.
First time running on WSL:
- Clone
dotfiles
repo to ~/repos directory - Run
bootstrap.sh
: cd to~/repos/dotfiles
and runbash bootstrap.sh
to create sym links - Install broot (see above)
- Install miniconda3 (see above)
- Install dotnet core with
sudo apt-get install -y dotnet-runtime-2.1
(more details: here) - Install azure cli (see docs)