about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-08-23 23:07:31 -0500
committerCase Duckworth2021-08-23 23:07:31 -0500
commite292eb508413b9174684a8e75c93474a7f5351ee (patch)
treee7e59b21c817bfd1c438ef3cfc68b9021e786d7c
downloadetc-e292eb508413b9174684a8e75c93474a7f5351ee.tar.gz
etc-e292eb508413b9174684a8e75c93474a7f5351ee.zip
Initial
-rw-r--r--Makefile10
-rw-r--r--bash/aliases.bash26
-rw-r--r--bash/blesh.bash.disable1
-rw-r--r--bash/dircolors.bash1
-rw-r--r--bash/functions.bash11
-rw-r--r--bash/guix.bash3
-rw-r--r--bash/history.bash35
-rw-r--r--bash/man.bash9
-rw-r--r--bash/please.bash14
-rw-r--r--bash/prompt.bash25
-rw-r--r--bootstrap/bash_logout6
-rw-r--r--bootstrap/bash_profile4
-rw-r--r--bootstrap/bashrc41
-rw-r--r--bootstrap/profile17
-rw-r--r--git/attributes3
-rw-r--r--git/config90
-rw-r--r--git/ignore3
-rw-r--r--profile/defaults.sh4
-rw-r--r--profile/etc.sh10
-rw-r--r--profile/infopath.sh1
-rw-r--r--profile/less.sh3
-rw-r--r--profile/luarocks.sh4
-rw-r--r--profile/manpath.sh9
-rw-r--r--profile/path.sh30
-rw-r--r--profile/xdg.sh27
-rw-r--r--readline/inputrc22
-rw-r--r--user-dirs.dirs15
27 files changed, 424 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..712877b --- /dev/null +++ b/Makefile
@@ -0,0 +1,10 @@
1# ~/etc/ Makefile
2
3BOOTSTRAPS:=$(wildcard bootstrap/*)
4BOOTSTRAPS_OUT:=$(foreach b,$(BOOTSTRAPS),$(patsubst bootstrap/%,~/.%,$(b)))
5
6.PHONY: bootstrap
7bootstrap: $(BOOTSTRAPS_OUT)
8
9~/.%: bootstrap/%
10 ln -sf etc/$< $@
diff --git a/bash/aliases.bash b/bash/aliases.bash new file mode 100644 index 0000000..f2d6776 --- /dev/null +++ b/bash/aliases.bash
@@ -0,0 +1,26 @@
1# Bash aliases
2
3# sudo
4sudo_cmds=(
5 shutdown
6 reboot
7 halt
8 mount
9 umount
10 visudo
11)
12for cmd in "${sudo_cmds[@]}"; do
13 alias $cmd="sudo $cmd"
14done
15
16# LS
17alias ls='ls -F --color=auto'
18alias ll='ls -l'
19# tree
20alias tree='tree -F'
21
22# make locally
23alias lake='make PREFIX=~/usr'
24
25# bash meta
26alias rebash='source ~/.bash_profile'
diff --git a/bash/blesh.bash.disable b/bash/blesh.bash.disable new file mode 100644 index 0000000..9fc617b --- /dev/null +++ b/bash/blesh.bash.disable
@@ -0,0 +1 @@
source "$XDG_DATA_HOME/blesh/ble.sh"
diff --git a/bash/dircolors.bash b/bash/dircolors.bash new file mode 100644 index 0000000..597ee95 --- /dev/null +++ b/bash/dircolors.bash
@@ -0,0 +1 @@
eval $(dircolors --sh "${XDG_CONFIG_HOME:-$HOME/.config}/dircolors")
diff --git a/bash/functions.bash b/bash/functions.bash new file mode 100644 index 0000000..058e0f9 --- /dev/null +++ b/bash/functions.bash
@@ -0,0 +1,11 @@
1memq() { # memq ITEM ARRAY
2 # Test whether an ITEM is a member of ARRAY.
3 # Pass ARRAY as ${ARRAY[@]}.
4 local e needle="$1"; shift
5 for e; do
6 [[ "$e" == "$needle" ]] && {
7 return 0
8 }
9 done
10 return 1
11}
diff --git a/bash/guix.bash b/bash/guix.bash new file mode 100644 index 0000000..127afef --- /dev/null +++ b/bash/guix.bash
@@ -0,0 +1,3 @@
1export GUIX_PROFILE="$HOME/.config/guix/current"
2
3. "$GUIX_PROFILE/etc/profile"
diff --git a/bash/history.bash b/bash/history.bash new file mode 100644 index 0000000..95edf9d --- /dev/null +++ b/bash/history.bash
@@ -0,0 +1,35 @@
1# Bash history settings
2# I don't export any variables in this file because history settings
3# really only apply in an interactive session.
4
5# XDG compliance
6HISTFILE="$XDG_DATA_HOME/bash/history"
7mkdir -p "$XDG_DATA_HOME/bash"
8
9# Don't truncate history
10HISTFILESIZE=-1 # numeric values less than zero => don't truncate
11HISTSIZE=100000 # ideally, I wouldn't truncate at all, but after a while shell
12# startup might be affected.
13
14# Append the history to HISTFILE.
15shopt -s histappend
16
17# History editing with readline
18shopt -s histreedit # allow re-editing of a failed history substitution
19shopt -s histverify # verify a history expansion before running it
20
21# Save command invocation time to HISTFILE, and format it thusly
22HISTTIMEFORMAT="%F %T "
23
24# Erase all duplicates before saving the current line
25HISTCONTROL=erasedups
26# Don't save some commands to history
27# "'HISTIGNORE' subsumes the function of 'HISTCONTROL'. A pattern of
28# '&' is identical to 'ignoredups', and a pattern of '[ ]*' is
29# identical to 'ignorespace'." -- info (bash)Bash Variables
30HISTIGNORE='&:[ ]*'
31# Other commands to ignore
32HISTIGNORE="$HISTIGNORE:ls:exit:cd"
33
34# Automatically append to HISTFILE on every command
35PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-:}"
diff --git a/bash/man.bash b/bash/man.bash new file mode 100644 index 0000000..4927952 --- /dev/null +++ b/bash/man.bash
@@ -0,0 +1,9 @@
1export MANWIDTH=80
2
3# on smaller terminals, use their width
4# (cf. https://wiki.archlinux.org/index.php/Man_page#Page_width)
5man() {
6 local width=$(tput cols)
7 [ $width -gt $MANWIDTH ] && width=$MANWIDTH
8 env MANWIDTH=$width man "$@"
9}
diff --git a/bash/please.bash b/bash/please.bash new file mode 100644 index 0000000..179ed17 --- /dev/null +++ b/bash/please.bash
@@ -0,0 +1,14 @@
1# PLEASE
2# if run without arguments, run the last command with 'sudo' (aka sudo !!)
3# if run WITH arguments, alias as sudo
4
5please() {
6 history -d -1
7 if [ -z "$1" ]; then
8 #set -- $(HISTTIMEFORMAT=$'\t' history 2 | sed 's/^.*\t//;q')
9 set -- $(fc -lnr | sed 1q)
10 fi
11 echo >&2 sudo "$@"
12 history -s sudo "$@"
13 "${DEBUG:-false}" || sudo "$@"
14}
diff --git a/bash/prompt.bash b/bash/prompt.bash new file mode 100644 index 0000000..c61266b --- /dev/null +++ b/bash/prompt.bash
@@ -0,0 +1,25 @@
1# bash prompt
2
3PS1=
4
5# user, host, and cwd
6PROMPT_DIRTRIM=3 # how many dirs above current to print (rest are '...')
7PS1+='\[\e[36m\]\u@\h \w'
8
9# git bit
10source /usr/share/git/git-prompt.sh &&
11 PS1+='\[\e[35m\]$(__git_ps1)'
12
13# newline
14PS1+='\[\e[0m\]\n'
15
16# exit code (only if error)
17__prompt_exit_code() {
18 local ec=$?
19 (( $ec > 0 )) &&
20 printf "$ec"
21}
22PS1+='\[\e[31m\]$(__prompt_exit_code)\[\e[0m\]'
23
24# delimiter
25PS1+='; '
diff --git a/bootstrap/bash_logout b/bootstrap/bash_logout new file mode 100644 index 0000000..d6c9b7a --- /dev/null +++ b/bootstrap/bash_logout
@@ -0,0 +1,6 @@
1# bash_logout
2# vim:ft=sh
3
4if [[ -r "$XDG_CONFIG_HOME"/bash/logout ]]; then
5 source "$XDG_CONFIG_HOME"/bash/logout
6fi
diff --git a/bootstrap/bash_profile b/bootstrap/bash_profile new file mode 100644 index 0000000..4439ca7 --- /dev/null +++ b/bootstrap/bash_profile
@@ -0,0 +1,4 @@
1# bash_profile
2
3[[ -f ~/.profile ]] && source ~/.profile
4[[ -f ~/.bashrc ]] && source ~/.bashrc
diff --git a/bootstrap/bashrc b/bootstrap/bashrc new file mode 100644 index 0000000..4966e75 --- /dev/null +++ b/bootstrap/bashrc
@@ -0,0 +1,41 @@
1# bashrc
2
3# If not running interactively, don't do anything
4[[ $- != *i* ]] && return
5
6BASH_SOURCE_FIRST=(
7 aliases
8 functions
9)
10
11BASH_SOURCE_LAST=(
12 blesh
13)
14
15for f in "${BASH_SOURCE_FIRST[@]}"; do
16 file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash"
17 [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found"
18done
19
20for file in "$XDG_CONFIG_HOME"/bash/*.bash; do
21 file_base="${file##*/}"
22 memq "${file_base%.bash}" "${BASH_SOURCE_FIRST[@]}" && {
23 # echo >&2 "'$file' in BASH_SOURCE_FIRST, skipping"
24 continue
25 }
26 memq "${file_base%.bash}" "${BASH_SOURCE_LAST[@]}" && {
27 # echo >&2 "'$file' in BASH_SOURCE_LAST, skipping"
28 continue
29 }
30 [[ -r "$file" ]] && {
31 # echo >&2 "Sourcing '$file'"
32 source "$file"
33 }
34 unset file_base
35done
36
37for f in "${BASH_SOURCE_LAST[@]}"; do
38 file="${XDG_CONFIG_HOME:-$HOME/.config}/bash/$f.bash"
39 [[ -r "$file" ]] && source "$file" # || echo >&2 "no '$file' found"
40 true
41done
diff --git a/bootstrap/profile b/bootstrap/profile new file mode 100644 index 0000000..4cb459d --- /dev/null +++ b/bootstrap/profile
@@ -0,0 +1,17 @@
1# profile
2# vim:ft=sh
3
4# XDG directories
5export XDG_CONFIG_HOME="$HOME/etc"
6export XDG_CACHE_HOME="$HOME/var/cache"
7export XDG_DATA_HOME="$HOME/usr/share"
8
9export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
10export XDG_CONFIG_DIRS="${XDG_CONFIG_DIRS:-/etc/xdg}"
11
12# source files in $XDG_CONFIG_HOME/profile
13if [ -d "$XDG_CONFIG_HOME/profile" ]; then
14 for file in "$XDG_CONFIG_HOME"/profile/*.sh; do
15 [ -r "$file" ] && . "$file"
16 done
17fi
diff --git a/git/attributes b/git/attributes new file mode 100644 index 0000000..a5516e5 --- /dev/null +++ b/git/attributes
@@ -0,0 +1,3 @@
1*.lisp diff=lisp
2*.el diff=lisp
3*.org diff=org
diff --git a/git/config b/git/config new file mode 100644 index 0000000..cad9e12 --- /dev/null +++ b/git/config
@@ -0,0 +1,90 @@
1[user]
2 email = acdw@acdw.net
3 name = Case Duckworth
4
5[init]
6 defaultBranch = main
7
8[push]
9 default = simple
10
11[pull]
12 rebase = false
13
14[core]
15 editor = vim
16 precomposeunicode = true
17 pager = less
18 autocrlf = false
19 eol = lf
20
21[merge]
22 conflictstyle = diff3
23 tool = vimdiff
24
25[alias]
26 # Easier locations
27 root = rev-parse --show-toplevel
28 current-branch = rev-parse --abbrev-ref HEAD
29 # Easier listing and info
30 branches = branch -a
31 tags = tag -l
32 stashes = stash list
33 remotes = remote -v
34 staged = diff --cached
35 graph = log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset: %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order
36 precommit = diff --cached --diff-algorithm=minimal -w
37 # Easier actions
38 discard = checkout --
39 uncommit = reset --soft HEAD^
40 unstage = reset HEAD --
41 amend = commit --amend
42 pushall = !git remote | xargs -L1 git push --all
43 # Shortened commonalities
44 st = status -bs
45 ac = !git add . && git commit -m
46
47# diffing
48[diff "lisp"]
49 xfuncname = "^(\\(.*)$"
50[diff "org"]
51 xfuncname = "^(\\*+.*)$"
52
53; [credential]
54; helper = /home/case/.local/bin/pass-git-helper
55; useHttpPath = true
56
57[bash]
58 showUntrackedFiles = true
59 showDirtyState = true
60
61[sendemail]
62 smtpserver = smtp.fastmail.com
63 smtpuser = acdw@fastmail.com
64 smtpencryption = tls
65 smtpserverport = 465
66
67# Better urls
68[url "https://github.com/"]
69 insteadOf = "gh:"
70[url "git@github.com:"]
71 pushInsteadOf = "gh:"
72[github]
73 user = duckwork
74
75[url "https://gitlab.com/"]
76 insteadOf = "gl:"
77[url "git@gitlab.com:"]
78 pushInsteadOf = "gl:"
79[gitlab]
80 user = acdw
81
82[url "https://git.sr.ht/"]
83 insteadOf = "sr:"
84[url "git@git.sr.ht:"]
85 pushInsteadOf = "sr:"
86
87[url "https://tildegit.org/"]
88 insteadOf = "tg:"
89[url "git@tildegit.org:"]
90 pushInsteadOf = "tg:"
diff --git a/git/ignore b/git/ignore new file mode 100644 index 0000000..6a4c747 --- /dev/null +++ b/git/ignore
@@ -0,0 +1,3 @@
1*.sw?
2*~
3.DS\_Store
diff --git a/profile/defaults.sh b/profile/defaults.sh new file mode 100644 index 0000000..8facc97 --- /dev/null +++ b/profile/defaults.sh
@@ -0,0 +1,4 @@
1# Default programs
2
3export EDITOR="$(which vim)" # TODO: change to emacs
4export VISUAL="$EDITOR"
diff --git a/profile/etc.sh b/profile/etc.sh new file mode 100644 index 0000000..5458f02 --- /dev/null +++ b/profile/etc.sh
@@ -0,0 +1,10 @@
1# etc. settings
2
3export GUILE_INSTALL_LOCALE=0
4export TZ=America/Chicago
5
6#export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
7#export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc"
8#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
9#export SVDIR="$HOME/.local/service"
10#export INFOPATH="$INFOPATH:/usr/share/info"
diff --git a/profile/infopath.sh b/profile/infopath.sh new file mode 100644 index 0000000..ad1ec3f --- /dev/null +++ b/profile/infopath.sh
@@ -0,0 +1 @@
export INFOPATH="/usr/share/info:${XDG_DATA_HOME:-$HOME/.local/share}/info"
diff --git a/profile/less.sh b/profile/less.sh new file mode 100644 index 0000000..19a73ce --- /dev/null +++ b/profile/less.sh
@@ -0,0 +1,3 @@
1# less settings
2
3export LESS="--mouse --RAW-CONTROL-CHARS"
diff --git a/profile/luarocks.sh b/profile/luarocks.sh new file mode 100644 index 0000000..315c0b7 --- /dev/null +++ b/profile/luarocks.sh
@@ -0,0 +1,4 @@
1# add luarocks stuff to $PATH
2
3command -v luarocks >/dev/null 2>&1 &&
4 eval $(luarocks path)
diff --git a/profile/manpath.sh b/profile/manpath.sh new file mode 100644 index 0000000..def1963 --- /dev/null +++ b/profile/manpath.sh
@@ -0,0 +1,9 @@
1# $MANPATH shouldn't be too extra complicated (as opposed to $PATH),
2# so I'm not going to include a whole other function. AT SOME POINT,
3# I suppose I should generalize that function to set /any/ path-type
4# variable, not just $PATH.
5# $MANPATH ends with `:' so that manpath(1) will prepend it to its
6# special thing.
7
8MANPATH="${XDG_DATA_HOME:-$HOME/.local/share}/man:"
9export MANPATH
diff --git a/profile/path.sh b/profile/path.sh new file mode 100644 index 0000000..56bdc39 --- /dev/null +++ b/profile/path.sh
@@ -0,0 +1,30 @@
1# PATH
2
3# add a path to PATH, but only if it's not already there
4path_add() { # path_add [-a] PATH...
5 # -a appends (default is prepend)
6 APPEND=false
7 if [ "x$1" = "x-a" ]; then
8 APPEND=true
9 shift
10 fi
11
12 for p; do
13 case ":$PATH:" in
14 *:"$p":*) ;;
15 *)
16 if $APPEND; then
17 PATH="$PATH:$p"
18 else
19 PATH="$p:$PATH"
20 fi
21 ;;
22 esac
23 done
24
25 unset APPEND
26}
27
28path_add "$HOME/bin" "$HOME/usr/bin"
29
30command -v luarocks >/dev/null 2>&1 && path_add "$HOME/.luarocks/bin"
diff --git a/profile/xdg.sh b/profile/xdg.sh new file mode 100644 index 0000000..caa1a9a --- /dev/null +++ b/profile/xdg.sh
@@ -0,0 +1,27 @@
1# XDG compliance (miscellaneous)
2
3# If an XDG-complaint variable makes more sense somewhere else, it'll be
4# moved there (e.g., HISTFILE is in history.bash). So variables might
5# move /out/ of this directory, but they probably won't move /in/.
6
7# Readline
8export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
9
10# Less
11export LESSKEY="$XDG_CONFIG_HOME"/less/lesskey
12export LESSHISTFILE="$XDG_CACHE_HOME"/less/history
13mkdir -p "$XDG_CACHE_HOME"/less
14
15# Vim
16export VIMINIT="let \$MYVIMRC=\"$XDG_CONFIG_HOME/vim/vimrc\" | source \$MYVIMRC"
17
18# Weechat
19export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat"
20
21# Lynx
22export LYNX_CFG="$XDG_CONFIG_HOME/lynx/lynx.cfg"
23
24# Xorg
25export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc"
26export XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc"
27export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority"
diff --git a/readline/inputrc b/readline/inputrc new file mode 100644 index 0000000..424e7d9 --- /dev/null +++ b/readline/inputrc
@@ -0,0 +1,22 @@
1# inputrc
2
3# Include the system inputrc
4$include /etc/inputrc
5
6# Search based on what I've already typed
7"\C-p":history-search-backward
8"\C-n":history-search-forward
9
10# Show completions using LS_COLORS
11set colored-stats On
12# Ignore case in completions
13set completion-ignore-case On
14# Show ... if common prefix is longer than 3 characters
15set completion-prefix-display-length 3
16# Show symlinked directories with a slash
17set mark-symlinked-directories On
18# Show completions immediately
19set show-all-if-ambiguous On
20set show-all-if-unmodified On
21# Show types (like ls -F)
22set visible-stats On
diff --git a/user-dirs.dirs b/user-dirs.dirs new file mode 100644 index 0000000..8c03e11 --- /dev/null +++ b/user-dirs.dirs
@@ -0,0 +1,15 @@
1# This file is written by xdg-user-dirs-update
2# If you want to change or add directories, just edit the line you're
3# interested in. All local changes will be retained on the next run.
4# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
5# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
6# absolute path. No other format is supported.
7#
8XDG_DESKTOP_DIR="$HOME/var/desk"
9XDG_DOCUMENTS_DIR="$HOME/var/doc"
10XDG_DOWNLOAD_DIR="$HOME/var/download"
11XDG_MUSIC_DIR="$HOME/var/music"
12XDG_PICTURES_DIR="$HOME/var/img"
13XDG_PUBLICSHARE_DIR="$HOME/var/public"
14XDG_TEMPLATES_DIR="$HOME/var/tmpl"
15XDG_VIDEOS_DIR="$HOME/var/video"