diff options
author | Matt Singleton <matt@xcolour.net> | 2021-02-06 13:39:13 -0600 |
---|---|---|
committer | Matt Singleton <matt@xcolour.net> | 2021-02-06 13:39:13 -0600 |
commit | e6a2618400edcddc2a80ef2776871ca01992be03 (patch) | |
tree | 72f9572bd8037f8d40abf070fc13c52fec9b5521 | |
parent | 9ec86efc56ecdbcaf6ee0626f928c16c266cda2c (diff) |
big refactor to use XDG base dir spec
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 29 | ||||
-rw-r--r-- | config/dircolors.conf (renamed from dircolors.conf) | 0 | ||||
-rw-r--r-- | config/git/config (renamed from gitconfig) | 0 | ||||
-rw-r--r-- | config/git/ignore (renamed from gitignore) | 0 | ||||
-rw-r--r-- | config/tmux/tmux.conf (renamed from xdg-config/tmux/tmux.conf) | 0 | ||||
-rw-r--r-- | config/zsh/.zshrc | 3 | ||||
-rw-r--r-- | config/zsh/appearance.zsh (renamed from zsh/appearance.zsh) | 2 | ||||
-rw-r--r-- | config/zsh/behavior.zsh (renamed from zsh/behavior.zsh) | 2 | ||||
-rw-r--r-- | config/zsh/completion.zsh (renamed from zsh/completion.zsh) | 2 | ||||
-rw-r--r-- | config/zsh/function-overrides.zsh (renamed from zsh/functions.zsh-overrides) | 0 | ||||
-rw-r--r-- | config/zsh/key-bindings.zsh (renamed from zsh/key-bindings.zsh) | 0 | ||||
-rw-r--r-- | config/zsh/zshrc | 17 | ||||
-rw-r--r-- | config/zsh/zshrc-local | 23 | ||||
-rwxr-xr-x | deploy.sh | 25 | ||||
-rw-r--r-- | gvimrc | 6 | ||||
-rw-r--r-- | zshenv | 1 | ||||
-rw-r--r-- | zshrc | 17 |
18 files changed, 72 insertions, 56 deletions
@@ -1,2 +1,3 @@ vim/ dotfiles-backup +xdg-config/zsh/zshrc-local @@ -1,23 +1,16 @@ -You're going to want to make changes, so before you do anything, fork this repo -and make it your own. - -Clone it somewhere on your local machine: - - $ git clone git://github.com/xcolour/dotfiles.git ~/.dotfiles - -Then run the deploy script: +Install dotfiles with the deploy script: $ sh deploy.sh -This script does the following: +Tries to follow the [XDG base directory +spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) +as much as possible. + +The script does the following: - Clear out `$PWD/dotfiles-backup/`. - - Back up any existing dotfiles to `$PWD/dotfiles-backup/`. - - Replace existing dotfiles with symlinks to the corresponding file in the - repo. + - Symlink everything under `config` into `$XDG_CONFIG_HOME`. Moves everything + that already exists to `$PWD/dotfiles-backup/` first. + - Symlink `vimrc` and `zshrc` into `$HOME`. Again back up existing files to + `$PWD/dotfiles-backup`. - Clone Vundle into `~/.vim/bundle/vundle/` and run `BundleInstall`. - will back up any existing dotfiles to `$PWD/dotfiles-backup/` - - Create `~/.zshrc-local` (if one doesn't already exist) for setting up local - behavior. Take a look inside for ideas. - -The prompt will highligh the local host name in red unless `ZSH_LOCAL_ENV=true` -is set. That's a good one for `~/.zshrc-local`. + - Create `~/.zshrc-local` if one doesn't already exist. diff --git a/dircolors.conf b/config/dircolors.conf index cfd5f8d..cfd5f8d 100644 --- a/dircolors.conf +++ b/config/dircolors.conf diff --git a/gitconfig b/config/git/config index f68fed8..f68fed8 100644 --- a/gitconfig +++ b/config/git/config diff --git a/gitignore b/config/git/ignore index 57dd8e6..57dd8e6 100644 --- a/gitignore +++ b/config/git/ignore diff --git a/xdg-config/tmux/tmux.conf b/config/tmux/tmux.conf index b1b98e0..b1b98e0 100644 --- a/xdg-config/tmux/tmux.conf +++ b/config/tmux/tmux.conf diff --git a/config/zsh/.zshrc b/config/zsh/.zshrc new file mode 100644 index 0000000..ee3ebdd --- /dev/null +++ b/config/zsh/.zshrc @@ -0,0 +1,3 @@ +# just a shim to make the real zshrc not hidden +# since zsh doesn't support renaming the config +source "$ZDOTDIR/zshrc" diff --git a/zsh/appearance.zsh b/config/zsh/appearance.zsh index 620ef54..e7132a8 100644 --- a/zsh/appearance.zsh +++ b/config/zsh/appearance.zsh @@ -3,7 +3,7 @@ if ls --color -d . &>/dev/null 2>&1; then alias ls='ls --color=tty' - eval `dircolors ~/.dircolors.conf` + eval `dircolors ${XDG_CONFIG_HOME:-${HOME}/.config}/dircolors.conf` else alias ls='ls -G' export LSCOLORS="exgxbxdxcxegedxbxgxcxd" diff --git a/zsh/behavior.zsh b/config/zsh/behavior.zsh index 84e5bfc..e7e6b81 100644 --- a/zsh/behavior.zsh +++ b/config/zsh/behavior.zsh @@ -8,7 +8,7 @@ unsetopt flowcontrol # disable ^s from freezing the terminal # # history -HISTFILE=$HOME/.zsh_history +HISTFILE="${XDG_DATA_HOME:-${HOME}/.local/share}/zsh/history" HISTSIZE=10000 SAVEHIST=10000 diff --git a/zsh/completion.zsh b/config/zsh/completion.zsh index 5c8160a..740e9a3 100644 --- a/zsh/completion.zsh +++ b/config/zsh/completion.zsh @@ -1,7 +1,7 @@ # initialize the completion system autoload -U compinit zmodload zsh/complist -compinit +compinit -d "${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/zcompdump-${ZSH_VERSION}" # complete only after the second consecutive tab setopt auto_menu diff --git a/zsh/functions.zsh-overrides b/config/zsh/function-overrides.zsh index 8b233e5..8b233e5 100644 --- a/zsh/functions.zsh-overrides +++ b/config/zsh/function-overrides.zsh diff --git a/zsh/key-bindings.zsh b/config/zsh/key-bindings.zsh index 4deac62..4deac62 100644 --- a/zsh/key-bindings.zsh +++ b/config/zsh/key-bindings.zsh diff --git a/config/zsh/zshrc b/config/zsh/zshrc new file mode 100644 index 0000000..2a0fcf0 --- /dev/null +++ b/config/zsh/zshrc @@ -0,0 +1,17 @@ +export EDITOR=vim +export LANG=en_US.UTF-8 + +if [ -e "$ZDOTDIR/zshrc-local" ]; then + source "$ZDOTDIR/zshrc-local" +fi + +source "$ZDOTDIR/appearance.zsh" +source "$ZDOTDIR/behavior.zsh" +source "$ZDOTDIR/completion.zsh" +source "$ZDOTDIR/key-bindings.zsh" + +# override builtin functions (preexec, precmd, etc.) +source "$ZDOTDIR/function-overrides.zsh" + +# user bin should take absolute priority +export PATH="$HOME/bin:$PATH" diff --git a/config/zsh/zshrc-local b/config/zsh/zshrc-local new file mode 100644 index 0000000..50a16b2 --- /dev/null +++ b/config/zsh/zshrc-local @@ -0,0 +1,23 @@ +# get sbin on the path +#export PATH="/usr/sbin:/sbin:$PATH" + +# move homebrew stuff to the beginning of the search path +#export PATH="/usr/local/bin:/usr/local/sbin:$PATH" +#export MANPATH="/usr/local/man:$MANPATH" +#export PATH="/usr/local/opt/python/libexec/bin:$PATH" +#export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" +#export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/findutils/libexec/gnuman:$MANPATH" +#export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH" +#export MANPATH="/usr/local/opt/grep/libexec/gnuman:$MANPATH" + +# Java +#export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)" + +# start the ssh agent on login and stop on logout +#eval `ssh-agent -s` +#trap 'eval `ssh-agent -k`' 0 + +# prompt hostname is highlighted in red for non-local envs +export ZSH_LOCAL_ENV=true @@ -5,25 +5,26 @@ set -e rm -rf dotfiles-backup mkdir -p dotfiles-backup +# XDG layout +xcache="${XDG_CACHE_HOME:-${HOME}/.cache}" +xdata="${XDG_DATA_HOME:-${HOME}/.local/share}" +xconfig="${XDG_CONFIG_HOME:-${HOME}/.config}" + # deploy -if [ -z "$XDG_CONFIG_HOME" ]; -then - config_home="$HOME/.config" -else - config_home="$XDG_CONFIG_HOME" -fi -cd xdg-config +mkdir -p "${xcache}/zsh" +mkdir -p "${xdata}/zsh" +cd config for d in * do - dest="$config_home/$d" + dest="${xconfig}/$d" if [ -e "$dest" ]; then - mv "$dest" ../dotfiles-backup/$d + mv "$dest" "../dotfiles-backup/$d" fi ln -sf "$(pwd)/$d" "$dest" done cd .. -for f in vimrc gvimrc gitconfig gitignore zshrc zsh dircolors.conf +for f in vimrc zshenv do if [ -e ~/.${f} ]; then mv ~/.${f} dotfiles-backup/${f} @@ -40,6 +41,6 @@ fi vim +BundleInstall +qall vim +BundleClean +qall -if [ ! -e ~/.zshrc-local ]; then - cp zshrc-local ~/.zshrc-local +if [ ! -e config/zsh/zshrc-local ]; then + cp zshrc-local config/zsh/zshrc-local fi @@ -1,6 +0,0 @@ -" TODO: make me platform independent - -set guifont=Anonymous\ Pro:h16 -set guioptions-=T -set lines=40 "just make it as tall as possible -set columns=120 @@ -0,0 +1 @@ +export ZDOTDIR="${XDG_CONFIG_HOME:-${HOME}/.config}/zsh" @@ -1,17 +0,0 @@ -export EDITOR=vim -export LANG=en_US.UTF-8 - -if [ -e "$HOME/.zshrc-local" ]; then - source "$HOME/.zshrc-local" -fi - -source "$HOME/.zsh/appearance.zsh" -source "$HOME/.zsh/behavior.zsh" -source "$HOME/.zsh/completion.zsh" -source "$HOME/.zsh/key-bindings.zsh" - -# override builtin functions (preexec, precmd, etc.) -source "$HOME/.zsh/functions.zsh-overrides" - -# user bin should take absolute priority -export PATH="$HOME/bin:$PATH" |