commit d6845babbcc57f89fd6a17544ffa2060ff3a6141 (patch) parent 7e61708d722121baaaa0d0dac8e689203b26bdd3 Author: Alex Karle <alex@alexkarle.com> Date: Sat, 26 Sep 2020 23:50:30 -0400 Put the dot back in dotfile I've been feeling for a while now that all these directories with one file are just confusing (i.e. mbsync/mbsyncrc ...) and so I've resolved to "put the dot back in dotfile" -- remove the nested subtrees, and mirror a real $HOME directory. Anything that I don't really want to be under $HOME, I'm tucking away in ~/etc, which feels appropriate (i.e. vc configs or perl setup, etc). This approach was inspired by this HN comment [0]. The beauty in this is that you can then use git to inspect the how $HOME looks as a worktree of this repository. The key thing here is that **it's not a full work tree!** there's no .git file in $HOME that links the two, so a rogue "git status" in $HOME won't trigger any output. All changes go through the "cfg" alias which diffs the repo (~/.cfg, bare) and the worktree ($HOME). On machines where I only want a fraction of the dotfiles (i.e. work), I can still do a full checkout and manually symlink. This was super easy to change with the exception of the submodules (hot dang were they tricky to move correctly) -- note to future self, the clone URL is in .git/config (not just .gitmodules)... Not much functional change, except for removing my zshrc, which I haven't used in ages anyways (oh my zsh on macOS? those were the early days for sure :) ). From a git perspective, there are no more .gitignores, being replaced with a single '*' entry. Despite it not being a true worktree I want to be able to `git add .` (force of habit) and not add my whole $HOME. I'll be curious to see how this simplifies/complicates working on multiple machines. I don't plan to maintain multiple branches, but that could change. [0]: https://news.ycombinator.com/item?id=11071754 Diffstat:
73 files changed, 94 insertions(+), 246 deletions(-)
diff --git a/.aliases b/.aliases @@ -0,0 +1,46 @@ +#!/bin/sh +# Aliases for all shells + +# Detect which `ls` flavor is in use +if ls --color > /dev/null 2>&1; then # GNU `ls` + colorflag="--color" +elif ls -G > /dev/null 2>&1; then # macOS `ls` + colorflag="-G" +fi + +# ls aliases +alias ls='ls ${colorflag}' +alias l='ls -lAh ${colorflag}' +alias ll='ls -lh ${colorflag}' + +# Git aliases +alias ga='git add' +alias gc='git commit --verbose' +alias gd='git diff' +alias gp='git push' +alias gs='git status' +alias gst='git status' +alias gl='git pull' +alias gco='git checkout' +alias gf='git fetch' +alias glg='git log --stat --decorate' +alias glgr='git log --oneline | head -n 10' +alias g_='git stash' +alias g_p='git stash pop' +alias gb='git branch' +alias grb='git rebase' +alias grs='git reset' +alias gm='git merge' +alias gg='git grep' +alias vlg='vim -c "GV"' # 'vim log' of a file + +# Quick Actions +alias curljson='curl -H "Content-Type: application/json"' +alias sysmail='mutt -f /var/mail/$USER' + +# Dotfile management +alias cfg='git --git-dir=$HOME/.cfg --work-tree=$HOME' + +# Lightweight funcs +aw() { w3m "https://wiki.archlinux.org/index.php?search=$1"; } +ddg() { w3m "https://duckduckgo.com/lite?q=$1"; } diff --git a/bash/bash_profile b/.bash_profile diff --git a/bash/bashrc b/.bashrc diff --git a/git/config b/.config/git/config diff --git a/git/ignore b/.config/git/ignore diff --git a/gtk/gtk-3.0/settings.ini b/.config/gtk-3.0/settings.ini diff --git a/mutt/README.md b/.config/mutt/README.md diff --git a/mutt/accounts/karleco.muttrc b/.config/mutt/accounts/karleco.muttrc diff --git a/mutt/mailcap b/.config/mutt/mailcap diff --git a/mutt/muttrc b/.config/mutt/muttrc diff --git a/nvim/init.vim b/.config/nvim/init.vim diff --git a/bash/console_theme b/.console_theme diff --git a/cwm/cwmrc b/.cwmrc diff --git a/vi/exrc b/.exrc diff --git a/gdb/gdbinit b/.gdbinit diff --git a/.gitignore b/.gitignore @@ -1,6 +1 @@ -# netrw places these files in nvim/ -.netrwhist - -# Compiled python files -*.pyc -__pycache__ +* diff --git a/.gitmodules b/.gitmodules @@ -1,24 +1,24 @@ -[submodule "vim/pack/mine/start/gruvbox"] - path = vim/pack/mine/start/gruvbox +[submodule ".vim/pack/mine/start/gruvbox"] + path = .vim/pack/mine/start/gruvbox url = https://github.com/akarle/gruvbox -[submodule "vim/pack/plugins/start/vim-fugitive"] - path = vim/pack/plugins/start/vim-fugitive +[submodule ".vim/pack/plugins/start/vim-fugitive"] + path = .vim/pack/plugins/start/vim-fugitive url = https://github.com/tpope/vim-fugitive -[submodule "vim/pack/plugins/start/gv.vim"] - path = vim/pack/plugins/start/gv.vim +[submodule ".vim/pack/plugins/start/gv.vim"] + path = .vim/pack/plugins/start/gv.vim url = https://github.com/junegunn/gv.vim -[submodule "vim/pack/plugins/start/vim-dirvish"] - path = vim/pack/plugins/start/vim-dirvish +[submodule ".vim/pack/plugins/start/vim-dirvish"] + path = .vim/pack/plugins/start/vim-dirvish url = https://github.com/justinmk/vim-dirvish -[submodule "vim/pack/plugins/start/vim-surround"] - path = vim/pack/plugins/start/vim-surround +[submodule ".vim/pack/plugins/start/vim-surround"] + path = .vim/pack/plugins/start/vim-surround url = https://github.com/tpope/vim-surround -[submodule "vim/pack/plugins/start/vim-commentary"] - path = vim/pack/plugins/start/vim-commentary +[submodule ".vim/pack/plugins/start/vim-commentary"] + path = .vim/pack/plugins/start/vim-commentary url = https://github.com/tpope/vim-commentary -[submodule "vim/pack/plugins/start/vim-gitgutter"] - path = vim/pack/plugins/start/vim-gitgutter +[submodule ".vim/pack/plugins/start/vim-gitgutter"] + path = .vim/pack/plugins/start/vim-gitgutter url = https://github.com/airblade/vim-gitgutter [submodule "deps/pash"] - path = deps/pash + path = etc/deps/pash url = https://github.com/dylanaraps/pash diff --git a/bash/inputrc b/.inputrc diff --git a/perl/perldb b/.perldb diff --git a/sh/profile b/.profile diff --git a/sh/shrc b/.shrc diff --git a/tmux/tmux.conf b/.tmux.conf diff --git a/vim/README.md b/.vim/README.md diff --git a/vim/autoload/vimrc.vim b/.vim/autoload/vimrc.vim diff --git a/vim/colors/vc.vim b/.vim/colors/vc.vim diff --git a/vim/ftplugin/go.vim b/.vim/ftplugin/go.vim diff --git a/vim/ftplugin/help.vim b/.vim/ftplugin/help.vim diff --git a/vim/ftplugin/html.vim b/.vim/ftplugin/html.vim diff --git a/vim/ftplugin/javascript.vim b/.vim/ftplugin/javascript.vim diff --git a/vim/ftplugin/man.vim b/.vim/ftplugin/man.vim diff --git a/vim/ftplugin/markdown.vim b/.vim/ftplugin/markdown.vim diff --git a/vim/ftplugin/pod.vim b/.vim/ftplugin/pod.vim diff --git a/vim/ftplugin/python.vim b/.vim/ftplugin/python.vim diff --git a/vim/ftplugin/tex.vim b/.vim/ftplugin/tex.vim diff --git a/vim/ftplugin/vader.vim b/.vim/ftplugin/vader.vim diff --git a/vim/ftplugin/vim.vim b/.vim/ftplugin/vim.vim diff --git a/vim/gvimrc b/.vim/gvimrc diff --git a/vim/improved.vim b/.vim/improved.vim diff --git a/.vim/pack/mine/start/gruvbox b/.vim/pack/mine/start/gruvbox @@ -0,0 +1 @@ +Subproject commit 6c59bb5d72abcab0f22fc819793cf1f3b53d1336 diff --git a/.vim/pack/plugins/start/gv.vim b/.vim/pack/plugins/start/gv.vim @@ -0,0 +1 @@ +Subproject commit 023b315ea1fb92aba20c71ef54f806d2903cfc9e diff --git a/.vim/pack/plugins/start/vim-commentary b/.vim/pack/plugins/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 141d9d32a9fb58fe474fcc89cd7221eb2dd57b3a diff --git a/.vim/pack/plugins/start/vim-dirvish b/.vim/pack/plugins/start/vim-dirvish @@ -0,0 +1 @@ +Subproject commit eba64ed111a3aab8121a0e5b6df62c6f19e05322 diff --git a/.vim/pack/plugins/start/vim-fugitive b/.vim/pack/plugins/start/vim-fugitive @@ -0,0 +1 @@ +Subproject commit 875a58c2e1b2022fb806a40f75c5c7b0f34667eb diff --git a/.vim/pack/plugins/start/vim-gitgutter b/.vim/pack/plugins/start/vim-gitgutter @@ -0,0 +1 @@ +Subproject commit c75c83df531881008f8cf903eab7cd68bc19ff7a diff --git a/.vim/pack/plugins/start/vim-surround b/.vim/pack/plugins/start/vim-surround @@ -0,0 +1 @@ +Subproject commit fab8621670f71637e9960003af28365129b1dfd0 diff --git a/vim/swp/.gitkeep b/.vim/swp/.gitkeep diff --git a/vim/syntax/python.vim b/.vim/syntax/python.vim diff --git a/vim/undo/.gitkeep b/.vim/undo/.gitkeep diff --git a/vim/vimrc b/.vim/vimrc diff --git a/X11/xinitrc b/.xinitrc diff --git a/README.md b/README.md @@ -1,16 +1,22 @@ -# dotfiles - +dotfiles +======== Vim, tmux, mutt... hope you enjoy the shell! What follows is my (ongoing) tooling journey. I'm currently on Linux both at home and at work, so the support for macOS and Windows is fleeting at best. -## Installation - +Installation +------------ I'm a big believer in the "do it yourself" style of dotfiles. Fork if you'd like, but don't blindly copy! -These configs work for me, but [definitely aren't for everyone](./vc/README.md). +These configs work for me, but [definitely aren't for everyone](./etc/vc/README.md). + +This all said, to set up a new machine I run: -This all said, [install.sh](./install.sh) is how I set up a new machine / -user account. +```sh +$ git clone --bare https://github.com/akarle/dotfiles ~/.cfg +$ git -C ~/.cfg config status.showUntrackedFiles no +$ alias cfg='git --git-dir=$HOME/.cfg --work-tree=$HOME' +$ cfg checkout # resolve any conflicts from existing files... +``` diff --git a/deps/pash b/deps/pash @@ -1 +0,0 @@ -Subproject commit 2fb2092447b1577b47fbf9bc682e7fcb7e98efce diff --git a/etc/deps/pash b/etc/deps/pash @@ -0,0 +1 @@ +Subproject commit 2fb2092447b1577b47fbf9bc682e7fcb7e98efce diff --git a/mbsync/mbsyncrc b/etc/mbsyncrc diff --git a/etc/perl/README.md b/etc/perl/README.md @@ -0,0 +1,11 @@ +# dotfiles/etc/perl + +The `cpanfile` contains all the CPAN modules I like to install +for Perl development. See also the [.perldb](.perldb) file for +history in the Perl debugger. + +To install them, first install `cpanm`, and then run: + +```sh +cpanm --installdeps /path/to/dotfiles/etc/perl +``` diff --git a/perl/cpanfile b/etc/perl/cpanfile diff --git a/vc/README.md b/etc/vc/README.md diff --git a/vc/personal.map b/etc/vc/personal.map diff --git a/vc/vconsole.conf b/etc/vc/vconsole.conf diff --git a/zsh/vi_prompt_append.zsh b/etc/vi_prompt_append.zsh diff --git a/install.sh b/install.sh @@ -1,57 +0,0 @@ -#!/bin/sh -# Minimal install (no prereqs, just the basics) -# Intended to be run on a new account, NOT for long term management -# However, should be safe to rerun to fix/tune-up an existing install -set -e - -DOTFILES="$( cd "$(dirname "$0")" ; pwd -P )" - -# ln with the right settings and a nicer message -try_ln() { - # bail out early if source doesn't exist - [ -e "$1" ] || return 0 - - # we know source is legit, set up dest - if [ -e "$2" ]; then - if [ -h "$2" ]; then - if [ `readlink $2` = "$1" ]; then - echo "[Up to Date ] $2" | sed "s#$HOME#~#" - else - ln -snf $1 $2 - echo "[Updated Link] $2" | sed "s#$HOME#~#" - fi - else - echo "[Fail:Exists ] $2" | sed "s#$HOME#~#" - return - fi - else - ln -snf $1 $2 - echo "[New ] $2" | sed "s#$HOME#~#" - fi -} - -# bin scripts -mkdir -p $HOME/bin -for f in $DOTFILES/bin/*; do - try_ln $f $HOME/bin/`basename $f` -done - -# XDG_CONFIG_HOME dirs -mkdir -p $HOME/.config -for d in mutt git nvim; do - try_ln $DOTFILES/$d $HOME/.config/$d -done - -# Traditional dotfiles -for d in bash tmux X11 sh vi; do - for f in $DOTFILES/$d/*; do - try_ln $f $HOME/.`basename $f` - done -done - -# Special cases -try_ln $DOTFILES/vim $HOME/.vim -try_ln $DOTFILES/deps/pash/pash $HOME/bin/pash - -# Touch files expected to be in the install -touch $HOME/.config/mutt/muttrc.local diff --git a/mutt/.gitignore b/mutt/.gitignore @@ -1,9 +0,0 @@ -# Not worth checking in encrypted passwords, as FastMail requires a different -# password for each client anyways... -*.gpg - -# Don't check in those emails ;) -cache - -# Local muttrc to determine which account to use, etc -muttrc.local diff --git a/perl/README.md b/perl/README.md @@ -1,18 +0,0 @@ -# dotfiles/perl - -Just a collection of files related to Perl that are useful to me. - -Some highlights: - -* `perldb` -- the Perl debugger config -* `cpanfile` -- a list of modules I can't live without (and install on any new - machine) - -## Installation - -1. Symlink perldb to ~/.perldb -2. Install `cpanm` and run the following: - -```sh -cpanm --installdeps /path/to/dotfiles/perl -``` diff --git a/sh/aliases b/sh/aliases @@ -1,43 +0,0 @@ -#!/bin/sh -# Aliases for all shells - -# Detect which `ls` flavor is in use -if ls --color > /dev/null 2>&1; then # GNU `ls` - colorflag="--color" -elif ls -G > /dev/null 2>&1; then # macOS `ls` - colorflag="-G" -fi - -# ls aliases -alias ls='ls ${colorflag}' -alias l='ls -lAh ${colorflag}' -alias ll='ls -lh ${colorflag}' - -# Git aliases -alias ga='git add' -alias gc='git commit --verbose' -alias gd='git diff' -alias gp='git push' -alias gs='git status' -alias gst='git status' -alias gl='git pull' -alias gco='git checkout' -alias gf='git fetch' -alias glg='git log --stat --decorate' -alias glgr='git log --oneline | head -n 10' -alias g_='git stash' -alias g_p='git stash pop' -alias gb='git branch' -alias grb='git rebase' -alias grs='git reset' -alias gm='git merge' -alias gg='git grep' -alias vlg='vim -c "GV"' # 'vim log' of a file - -# Quick Actions -alias curljson='curl -H "Content-Type: application/json"' -alias sysmail='mutt -f /var/mail/$USER' - -# Lightweight funcs -aw() { w3m "https://wiki.archlinux.org/index.php?search=$1"; } -ddg() { w3m "https://duckduckgo.com/lite?q=$1"; } diff --git a/vim/.gitignore b/vim/.gitignore @@ -1,17 +0,0 @@ -# Ignore files generated by editing -# Stuff like swp/ and undo/ really shouldn't be tracked -swp/ -spell/ -undo/ - -# Ignore plugin artifacts -.netrwhist - -# Ignore plugins -pack/ - -# Ignore tags -tags - -# Optional per-computer configuration -.vimrc.local diff --git a/vim/pack/mine/start/gruvbox b/vim/pack/mine/start/gruvbox @@ -1 +0,0 @@ -Subproject commit 6c59bb5d72abcab0f22fc819793cf1f3b53d1336 diff --git a/vim/pack/plugins/start/gv.vim b/vim/pack/plugins/start/gv.vim @@ -1 +0,0 @@ -Subproject commit 023b315ea1fb92aba20c71ef54f806d2903cfc9e diff --git a/vim/pack/plugins/start/vim-commentary b/vim/pack/plugins/start/vim-commentary @@ -1 +0,0 @@ -Subproject commit 141d9d32a9fb58fe474fcc89cd7221eb2dd57b3a diff --git a/vim/pack/plugins/start/vim-dirvish b/vim/pack/plugins/start/vim-dirvish @@ -1 +0,0 @@ -Subproject commit eba64ed111a3aab8121a0e5b6df62c6f19e05322 diff --git a/vim/pack/plugins/start/vim-fugitive b/vim/pack/plugins/start/vim-fugitive @@ -1 +0,0 @@ -Subproject commit 875a58c2e1b2022fb806a40f75c5c7b0f34667eb diff --git a/vim/pack/plugins/start/vim-gitgutter b/vim/pack/plugins/start/vim-gitgutter @@ -1 +0,0 @@ -Subproject commit c75c83df531881008f8cf903eab7cd68bc19ff7a diff --git a/vim/pack/plugins/start/vim-surround b/vim/pack/plugins/start/vim-surround @@ -1 +0,0 @@ -Subproject commit fab8621670f71637e9960003af28365129b1dfd0 diff --git a/zsh/zshrc b/zsh/zshrc @@ -1,66 +0,0 @@ -# Path to your oh-my-zsh installation. -export ZSH=$HOME/.oh-my-zsh - -# zsh theme -ZSH_THEME="refined" - -# Zsh plugins ( Example format: plugins=(rails git textmate ruby lighthouse) ) -# note: zsh-syntax must be last! -plugins=(git zsh-syntax-highlighting docker) - -source $ZSH/oh-my-zsh.sh - -export DEFAULT_USER="$(whoami)" - -# prevent zsh from renaming tmux windows -DISABLE_AUTO_TITLE="true" - -# use nvim as man pager / editor if available -if (( $+commands[nvim] )); then - export EDITOR="nvim" - export MANPAGER="nvim -c 'set ft=man' -" - alias vim='nvim' -else - export EDITOR="vim" -fi - -# 10ms for key sequences -KEYTIMEOUT=1 - -# vi keymap in terminal -bindkey -v - -# backspace works past insert mode location -bindkey '^?' backward-delete-char - -# ctrl-r starts searching history backward -bindkey '^r' history-incremental-search-backward - -# Indicate vi mode! -local VI_PROMPT_APPEND_FILE=~/.akarledots/zsh/vi_prompt_append.zsh -if [[ -f "$VI_PROMPT_APPEND_FILE" ]]; then - source "$VI_PROMPT_APPEND_FILE" -fi - -# alias for homebrew versions of things -# alias ctags='/usr/local/Cellar/ctags/5.8_1/bin/ctags' -# alias python python2 - -# other alias' -alias dps="docker ps -a" - -# ITALICS UPDATE: may break ssh? -if [ $TERM = 'xterm-256color-italic' ]; then - alias ssh="TERM='xterm-256color' ssh" - alias vsh="TERM='xterm-256color' vagrant ssh" -else - alias vsh="vagrant ssh" -fi - -alias vsus="vagrant suspend" -alias vup="vagrant up" - -# cd to a parent directory -function pcd { cd ${PWD%/$1/*}/$1; } - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh