dotfiles

$HOME is where the <3 is
git clone git://git.alexkarle.com/dotfiles.git
Log | Files | Refs | Submodules | README

commit 80bbb7c25b45dcd42ef408a819e6c695a71764fa (patch)
parent ff081484e8640e496c93d98fea4d15d51581e855
Author: Alex Karle <alex@karle.co>
Date:   Sat,  2 Nov 2019 00:37:17 -0400

doc: update README, drop installation, finalize Vim merge

This commit marks two big organization changes:

1. I no longer recommend or offer a one-line install script. This was a
   pain to maintain and I've come to see the beauty in writing your own
   dotfiles!

   I have my own installer, but it's not ready for prime time yet...

2. Vim is officially re-merged. A year ago, I split it into a dotvim
   repository. Looking back now, this made sense at the time. I was on
   Windows, and updating my Vim config a lot and the dotfile stuff felt
   like fluff. Further, Windows' support for symlinks is spotty at best,
   so it was much more convenient to have the ~/vimfiles be a git repo.

   Now on Linux full-time, dotfiles (not just vim) are my
   bread-and-butter. Merging it back is both practical and provides a
   more complete history (my original .vimrc history is still here!).

For my own reference later, I remerged by doing the following:

    # in dotfiles, restore the vim/ dir to pre-deletion (splitSHA)
    $ git revert splitSHA
    # in dotvim, where divertedSHA was where I split it off
    $ git format-patch -o ~/patch divertedSHA^..HEAD
    # in dotfiles
    $ git am --directory vim ~/patch/*

Worked like a charm.

Diffstat:
MREADME.md | 38+++++++-------------------------------
Dbin/install.sh | 90-------------------------------------------------------------------------------
Dbin/link.sh | 68--------------------------------------------------------------------
Dbin/messages.sh | 39---------------------------------------
Minstall.sh | 5+++--
Mvim/README.md | 26+++++++++++++-------------
Mvim/vimrc | 2+-
7 files changed, 24 insertions(+), 244 deletions(-)

diff --git a/README.md b/README.md @@ -1,37 +1,13 @@ # dotfiles -My dotfiles. +Vim, tmux, mutt... hope you enjoy the shell! -## Install +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. -For a full-featured install, with interactive use (bash required) and options to -download my (Neo)Vim configuration along with other things I find useful, use -the [install.sh](bin/install.sh) script: +## Installation -```sh -# Download the installer -curl -fsSL https://raw.githubusercontent.com/akarle/dotfiles/master/bin/install.sh > install.sh +I'm a big believer in the "do it yourself" style of dotfiles. Fork if you'd +like, but don't blindly copy! -# Check it looks OK -less install.sh - -# Run it! -bash install.sh -``` - -Currently this installs: - -1. These dotfiles -2. My [dotvim](https://github.com/akarle/dotvim) repo (with favorite plugins as - submodules) -3. The git [bash-completion script](https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash) - -Alternatively, should you just want these dotfiles (and nothing else -downloaded), clone this repo and run [link.sh](link.sh) which will interactively -(and non-destructively) link each of the dotfiles to the proper location. - -```sh -git clone https://github.com/akarle/dotfiles -chmod +x dotfiles/bin/link.sh -./link.sh -``` +These configs work for me, but [definitely aren't for everyone](./vc/README.md). diff --git a/bin/install.sh b/bin/install.sh @@ -1,90 +0,0 @@ -#!/usr/bin/env bash -# This script sets up all dotfiles from scratch -# PREREQS: git -# -# NOTE: will not overwrite anything that already exists -# other than .akarledots (which will get backed up) -# -# If you want to just do symlinking, see ./link.sh - -# Before anything, require git to be installed -if ! [ -x "$(command -v git)" ]; then - echo "Error: git is not installed. Aborting..." >&2 - exit 1 -fi - -# Establish Globals -HOMEDOTS=$HOME/.akarledots -DOTVIM=$HOME/.vim - -# Load messages colors + functions -source $HOMEDOTS/bin/messages.sh - -install_via_curl() { - echo "Would you like to install $1 (via curl)" - select opt in "Yes" "No"; do - case $opt in - "Yes" ) - curl -fLo "$3" --create-dirs "$2" - break - ;; - "No" ) - echo "Not installing $1" - break - ;; - esac - done - echo "" - echo "" -} - -# First, backup old copies -if [ -d $HOMEDOTS ]; then - BACKUP="${HOMEDOTS}_backup_$(date +%s)" - mv $HOMEDOTS $BACKUP - warn_msg "Backing up old $HOMEDOTS to $BACKUP" -fi - -# Next, clone a fresh one -git clone https://github.com/akarle/dotfiles.git $HOMEDOTS -success_msg "Clone successful! Putting you on your own branch '$(whoami)' so you can make changes!" -(cd $HOMEDOTS && exec git checkout -b $(whoami)) - -# Do linking -success_msg "Linking..." -source $HOMEDOTS/bin/link.sh - -# Now for Vim -if [ -d $DOTVIM ]; then - BACKUP="${DOTVIM}_backup_$(date +%s)" - mv $DOTVIM $BACKUP - warn_msg "Backing up old $DOTVIM to $BACKUP" -fi - -git clone --recurse-submodules https://github.com/akarle/dotvim.git $DOTVIM -success_msg "Successfully cloned dotvim to $DOTVIM. Woot!" - -printf "\n\n" - -# Optional installs via curl: -if [ -x "$(command -v curl)" ]; then - # git bash/zsh completion - install_via_curl \ - "bash completion" \ - "https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash" \ - "$HOME/.bash/git-completion.bash" -fi - -# Logo a la oh-my-zsh (for funsies) -printf ${MAGENTA} -echo "" -echo "Thank you for installing..." -printf ${BOLD}${BLUE} -echo " _ _ _ _ " -echo " | | | | | | | | " -echo " __ _| | ____ _ _ __| | ___ __| | ___ | |_ ___ " -echo " / _ | |/ / _ | '__| |/ _ \/ _ |/ _ \| __/ __| " -echo "${MAGENTA} _${BLUE} | (_| | ( (_| | | | | __/ (_| | (_) | |_\__ \ " -echo "${MAGENTA}(_)${BLUE} \__,_|_|\_\__,_|_| |_|\___|\__,_|\___/ \__|___/ " -printf ${RESET} -echo "" diff --git a/bin/link.sh b/bin/link.sh @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# link.sh -# Handles all (re)linking of dotfiles to their appropriate place - -# Establish Globals -HOMEDOTS="$( cd "$(dirname $(dirname "$0"))" ; pwd -P )" -CONFDIR=$HOME/.config - -# Load messages colors + functions -source $HOMEDOTS/bin/messages.sh - -try_ln() { - # if its a symlink replace it - if [ -L $2 ]; then - warn_msg "$2 is a symlink already, replacing it with a symlink to $1" - rm $2 - ln -s $1 $2 - # if it doesn't exist, just create it -- works for broken symlinks too! - elif [ ! -e $2 ]; then - success_msg "Creating soft symlink from $1 to $2" - ln -s $1 $2 - # if it exists but is not a symlink - else - error_msg "$2 exists as a file that is NOT a symlink. What would you like to do?" - OPT1="Move it to $HOMEDOTS for further inspection and add akarledots link in its place" - OPT2="Delete and replace it with akarledots link" - OPT3="Keep it and do not create akarledots link" - select opt in "$OPT1" "$OPT2" "$OPT3"; do - case $opt in - $OPT1 ) - TMPFILE=$2.BACKUP - mv $2 $TMPFILE - mv $TMPFILE $HOMEDOTS/ - ln -s $1 $2 - break - ;; - $OPT2 ) - rm $2 - ln -s $1 $2 - break - ;; - $OPT3 ) - echo "Not altering $2" - break - ;; - esac - done - fi -} - -# $HOME level ln's -try_ln $HOMEDOTS/tmux/tmux.conf $HOME/.tmux.conf -try_ln $HOMEDOTS/zsh/zshrc $HOME/.zshrc -try_ln $HOMEDOTS/screen/screenrc $HOME/.screenrc -try_ln $HOMEDOTS/gdb/gdbinit $HOME/.gdbinit -try_ln $HOMEDOTS/perl/perldb $HOME/.perldb -try_ln $HOMEDOTS/git/global_gitignore $HOME/.global_gitignore - -# .config lns -try_ln $HOMEDOTS/alacritty $CONFDIR/alacritty -try_ln $HOMEDOTS/nvim $CONFDIR/nvim - -# bash lns -for file in $HOMEDOTS/bash/*; do - [ -e "$file" ] || continue - try_ln $file $HOME/.$(basename $file) -done -unset file diff --git a/bin/messages.sh b/bin/messages.sh @@ -1,39 +0,0 @@ -#!/usr/bin/env bash -# messages.sh -# Code to setup variables for pretty and colorful messages - -# Define colors (for printouts) -if tput setaf 1 &> /dev/null; then tput sgr0 - BOLD="$(tput bold)" - MAGENTA="$(tput setaf 5)" - GREEN="$(tput setaf 2)" - RED="$(tput setaf 1)" - RESET="$(tput sgr0)" - if [[ $(tput colors) -ge 16 ]] 2>/dev/null; then - BLUE="$(tput setaf 12)" - ORANGE="$(tput setaf 11)" - else - BLUE="$(tput setaf 4)" - ORANGE="$(tput setaf 3)" - fi -else - BLUE="" - BOLD="" - ORANGE="" - RED="" - GREEN="" - RESET="" -fi - -# Helper functions -success_msg() { - echo "${GREEN}$1${RESET}" -} - -warn_msg() { - echo "${ORANGE}$1${RESET}" -} - -error_msg() { - echo "${RED}$1${RESET}" -} diff --git a/install.sh b/install.sh @@ -10,11 +10,12 @@ fi mkdir -p $HOME/.config mkdir -p $HOME/dev/proj -echo "Installing dotvim -> $HOME/.vim" -git clone --recursive https://github.com/akarle/dotvim $HOME/.vim || exit 1 echo "Installing dotfiler -> $HOME/dev/proj/dotfiler" git clone https://github.com/akarle/dotfiler $HOME/dev/proj/dotfiler || exit 1 echo "Using dotfiler to link bash (bare minimum)" PATH=$HOME/dev/proj/dotfiler:$PATH dotfiler.pl -d $HOME/dev/dotfiles -l bash tmux + +# dotfiler doesn't support .vim yet... +ln -s $HOME/dev/dotfiles/vim $HOME/.vim diff --git a/vim/README.md b/vim/README.md @@ -2,27 +2,27 @@ My personal Vim configuration. -This used to be part of my personal -[dotfiles](https://github.com/akarle/dotfiles), but I promoted it to its own -repo for greater portability and a cleaner history. - ## Install Mac/Linux: ```sh -git clone --recurse-submodules https://github.com/akarle/dotvim ~/.vim +git clone --recurse-submodules https://github.com/akarle/dotfiles ~/dotfiles +ln -s ~/dotfiles/vim ~/.vim ``` Windows: +If you can't figure out how to get symlinks to work (or they don't work, I never +understood them on Windows), set up a minimal vimrc that uses ~/dotfiles/vim as +the ~/vimfiles: + ```sh -git clone --recurse-submodules https://github.com/akarle/dotvim ~\vimfiles +git clone --recurse-submodules https://github.com/akarle/dotfiles ~/dotfiles +cat <<EOM > ~/_vimrc +set rtp ^= ~/dotfiles/vim +set rtp += ~/dotfiles/vim/after +set pp = &rtp +source ~/dotfiles/vim/vimrc +EOM ``` - -Note that in Vim 7.4 and newer **you don't need to symlink `~/.vim/vimrc` to -`~/.vimrc`**, making a one directory repo a cleaner and more portable option! - -However, if an old `~/.vimrc` file exists, it will be sourced before and instead -of `~/.vim/vimrc`. If you don't see expected behavior, you can always check the -loaded files with `:scriptnames` to diagnose the issue. diff --git a/vim/vimrc b/vim/vimrc @@ -1,5 +1,5 @@ " .vimrc by Alex Karle -" Hosted at https://github.com/akarle/dotvim +" Hosted at https://github.com/akarle/dotfiles " " Inspired by tips all over the interwebs