dotfiles

Here are the configuration files for the various tools I use along with a bunch of custom scripts and shell helper functions to reduce repetitive tasks.

bootstrap.sh

This is intended to be a shell script to install everything I like on a fresh MacBook. I wouldn't recommend anyone run the script on their own machine, partly as the script in its current state is fairly experimental and hasn't been tested thoroughly, and partly as it's rarely a good idea to install someone else's setup in its entirety.

The script should do roughly the following:

  1. Install some useful packages & casks via brew.
  2. Symlink a bunch of config files found in this repo to the relevant places.
  3. Install some useful python packages.
  4. Configure some OSX settings.

zsh

Functions in the .zsh/functions directory are autoloaded (lazy loaded) into the shell. Other .zsh files in the .zsh directory are directly sourced.

functions

general

name description keybinding
fza find an alias and paste to command line Ctrl+f Ctrl+a
fzh find a command from history and paste to command line Ctrl+r
z called without arguments to find a directory from z plugin's list, with
arguments acts like normal z
ssh called without arguments to find a remote, with arguments to be regular
ssh (requires rg)
vs open a readonly nvim buffer reading from stdout from a given command.
usage vs ls -lA
copy the current line to the system clipboard Ctrl+y
clc copy the previous command to the system clipboard
pubkey copy my public key to the system clipboard
please sudo the last command
v open suspended nvim session if it exists or start afresh
cpf f copy the contents of file f to the clipboard,
without arguments to fzf the file
fzm find a recipe from a Makefile in the cwd and run it
vact deactivate the current conda env and activate venv in current directory

git

name description keybinding
fzgf find a commit to fixup Ctrl+g Ctrl+f
fzgr find a commit to rebase onto Ctrl+g Ctrl+r
fzgs find a commit to show Ctrl+g Ctrl+s
fzgsp find a stash to pop Ctrl+g Ctrl+p
gfix fixup the latest commit
greb n rebase latest n commits (defaults to 1)
gb with arguments acts as normal git branch.
without arguments it brings up a menu to fzf a branch to checkout.
Use Ctrl+d to delete the branch under the cursor
gbdf multiselect git branches to force delete

docker

name description
dexec find a container to drop into
dlog find a container to retrieve logs
dstart find a stopped container to start
dstop find a started container(s) to stop
dimagerm find images to delete

kubernetes

name description
klog retrieve logs for a container
kdescp describe a pod
kdesc describe a resource
kexec drop into a container shell
kns ns switch to namespace ns or choose from a list if omitted
kyaml get yaml for a resource
kctx switch context
ktmp create a temporary busybox pod
kcsec sec ns1 ns2 copy secret sec from namespace ns1 to namespace ns2.
If arguments are omitted then user is prompted
kscaledown scale down all deployments and stateful sets in the current namespace
kscaleup scale up all deployments and stateful sets in the current namespace

helm

name description
hun uninstall a chart

scripts

These are located in scripts and provide some automation around tasks that I do regularly. See the README there for more information.

vim

To get up and running with a minimal vimrc:

vimrc="${HOME:-~}/.vimrc"
[[ ! -f $vimrc ]] \
  && curl https://raw.githubusercontent.com/dbatten5/dotfiles/main/.vimrc -o "$vimrc" \
  || echo ".vimrc already exists, not overwriting..."