aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-25 12:29:38 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-25 12:29:38 +1300
commitca762232041168ab7f6f02c66fb6b36bd0a582dd (patch)
treee7d9d68a0e0e68209857ec0d0373f766d8c8ec93
parentMerge branch 'master' into port/bsd/freebsd (diff)
parentBe more specific in ref name trimming (diff)
downloaddotfiles-ca762232041168ab7f6f02c66fb6b36bd0a582dd.tar.gz
dotfiles-ca762232041168ab7f6f02c66fb6b36bd0a582dd.zip
Merge branch 'master' into port/bsd/freebsd
-rw-r--r--.gitignore2
-rw-r--r--IDEAS.markdown2
-rw-r--r--ISSUES.markdown1
-rw-r--r--Makefile11
-rw-r--r--README.markdown44
-rw-r--r--X/xbindkeysrc12
-rw-r--r--X/xinitrc3
-rw-r--r--X/xinitrc.d/shlvl.sh2
-rw-r--r--X/xinitrc.d/xbackground.sh3
-rw-r--r--X/xinitrc.d/xbindkeys.sh2
-rw-r--r--X/xinitrc.d/xrbg.sh2
-rw-r--r--bash/bash_completion.d/path.bash2
-rw-r--r--bash/bashrc.d/prompt.bash8
-rw-r--r--bin/htref.sed2
-rwxr-xr-xbin/pph4
-rwxr-xr-xbin/rfcf9
-rwxr-xr-xbin/rfcr9
-rw-r--r--bin/sd2u.awk2
-rw-r--r--bin/su2d.awk2
-rwxr-xr-xbin/tm18
-rwxr-xr-xbin/vest2
-rwxr-xr-xbin/xgo22
-rwxr-xr-xbin/xrbg4
-rw-r--r--bin/xrq.awk27
-rw-r--r--i3/config3
-rw-r--r--ksh/kshrc.d/bind.ksh17
-rw-r--r--ksh/kshrc.d/prompt.ksh10
-rw-r--r--man/man1/htref.1df20
-rw-r--r--man/man1/tm.1df12
-rw-r--r--man/man1/xrbg.1df19
-rw-r--r--man/man1/xrq.1df16
-rw-r--r--readline/inputrc7
-rw-r--r--sh/profile.d/lang.sh4
-rw-r--r--sh/profile.d/options.sh11
-rw-r--r--sh/shrc.d/gd.sh2
-rw-r--r--sh/shrc.d/grep.sh3
-rw-r--r--sh/shrc.d/less.sh2
-rw-r--r--sh/shrc.d/ls.sh28
-rw-r--r--sh/shrc.d/md.sh13
-rw-r--r--sh/shrc.d/path.sh55
-rw-r--r--sh/shrc.d/pmd.sh2
-rw-r--r--sh/shrc.d/prompt.sh5
-rw-r--r--sh/shrc.d/tmux.sh19
-rw-r--r--sh/shrc.d/vr.sh15
-rw-r--r--sh/shrc.d/xd.sh2
-rw-r--r--tmux/tmux.conf.m419
-rw-r--r--vim/after/ftdetect/xdefaults.vim6
m---------vim/bundle/html50
m---------vim/bundle/lion0
-rw-r--r--wyrd/wyrdrc167
-rw-r--r--zsh/zshrc.d/completion.zsh19
-rw-r--r--zsh/zshrc.d/prompt.zsh8
52 files changed, 333 insertions, 346 deletions
diff --git a/.gitignore b/.gitignore
index a9f181be..91f646d3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ bin/jfp
bin/han
bin/htdec
bin/htenc
+bin/htref
bin/max
bin/mean
bin/med
@@ -23,6 +24,7 @@ bin/su2d
bin/tot
bin/unf
bin/uts
+bin/xrq
games/acq
games/aesth
games/chkl
diff --git a/IDEAS.markdown b/IDEAS.markdown
index 7f94b027..39d9511e 100644
--- a/IDEAS.markdown
+++ b/IDEAS.markdown
@@ -8,3 +8,5 @@ Ideas
manageable
* Have eds(1df) accept stdin with the "starting content" for the script
* Convert all the manual pages to mandoc maybe? <https://en.wikipedia.org/wiki/Mandoc>
+* Add "pop" and "shift" methods to path()
+* edio(1df), like vipe(1)
diff --git a/ISSUES.markdown b/ISSUES.markdown
index 383d7906..c2b7f350 100644
--- a/ISSUES.markdown
+++ b/ISSUES.markdown
@@ -15,6 +15,7 @@ Known issues
jobspecs around that flee after a jobs builtin run; only saw this manifest
after 90dcadf; either I understand job specs really poorly or this may be a
bug in bash
+ * Need to figure out whether this is still needed
* I can't find a clean way of detecting a restricted shell for ksh instances
to prevent trying to load anything fancy (works for Bash)
* Zsh, either! $options[restricted] is "off" within the startup file
diff --git a/Makefile b/Makefile
index 06d5adf3..e16dc944 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,6 @@
install-gvim-config \
install-vim-plugins \
install-vim-pathogen \
- install-wyrd \
install-x \
install-yash \
install-zsh \
@@ -74,6 +73,7 @@ BINS = bin/brnl \
bin/han \
bin/htdec \
bin/htenc \
+ bin/htref \
bin/jfp \
bin/max \
bin/mean \
@@ -92,6 +92,7 @@ BINS = bin/brnl \
bin/tot \
bin/unf \
bin/uts \
+ bin/xrq
GAMES = games/acq \
games/aesth \
@@ -136,10 +137,11 @@ mutt/muttrc : mutt/muttrc.m4
-D DOTFILES_SENDMAIL="$(SENDMAIL)" \
mutt/muttrc.m4 > mutt/muttrc
-TMUX_COLOR := colour237
+TMUX_BG := colour237
+TMUX_FG := colour248
tmux/tmux.conf : tmux/tmux.conf.m4
- m4 -D TMUX_COLOR="$(TMUX_COLOR)" \
+ m4 -D TMUX_BG="$(TMUX_BG)" -D TMUX_FG="$(TMUX_FG)" \
tmux/tmux.conf.m4 > tmux/tmux.conf
.awk :
@@ -360,9 +362,6 @@ install-vim-pathogen : install-vim-plugins
ln -s -- ../bundle/pathogen/autoload/pathogen.vim \
"$(HOME)"/.vim/autoload/pathogen.vim
-install-wyrd :
- install -pm 0644 -- wyrd/wyrdrc "$(HOME)"/.wyrdrc
-
install-x :
install -m 0755 -d -- \
"$(HOME)"/.config \
diff --git a/README.markdown b/README.markdown
index 97823267..9c956d51 100644
--- a/README.markdown
+++ b/README.markdown
@@ -77,8 +77,6 @@ Configuration is included for:
* [tmux](https://tmux.github.io/) -- Terminal multiplexer similar to GNU
Screen
* [Vim](http://www.vim.org/) -- Vi IMproved, a text editor
-* [Wyrd](https://packages.debian.org/sid/wyrd) -- a `curses` calendar
- frontend for [Remind](https://www.roaringpenguin.com/products/remind)
* [X11](https://www.x.org/wiki/) -- Windowing system with network
transparency for Unix
@@ -124,20 +122,17 @@ after testing `BASH_VERSINFO` appropriately.
A terminal session with my prompt looks something like this:
~$ ssh remote
- tom@remote:~$ bash
- >tom@remote:~$ cd .dotfiles
- >tom@remote:~/.dotfiles(master+!)$ git status
+ tom@remote:~$ cd .dotfiles
+ tom@remote:~/.dotfiles(master+!)$ git status
M README.markdown
M bash/bashrc.d/prompt.bash
A init
- >tom@remote:~/.dotfiles(master+!)$ foobar
+ tom@remote:~/.dotfiles(master+!)$ foobar
foobar: command not found
- >tom@remote:~/.dotfiles(master+!)<127>$ sleep 5 &
+ tom@remote:~/.dotfiles(master+!)<127>$ sleep 5 &
[1] 28937
- >tom@remote:~/.dotfiles(master+!){1}$
+ tom@remote:~/.dotfiles(master+!){1}$
-If `SHLVL` is greater than one, right angle brackets are added to show how many
-`bash` instances deep into the process tree we are, taking into account `tmux`.
The username and hostname are elided if not connected via SSH. The working
directory is always shown. The rest of the prompt expands based on context to
include these elements in this order:
@@ -145,13 +140,12 @@ include these elements in this order:
* Whether in a Git repository if applicable, and punctuation to show
repository status including reference to upstreams at a glance. Subversion
support can also be enabled (I need it at work), in which case a `git:` or
- `svn:` prefix is added appropriately
-* The number of running background jobs, if non-zero
-* The exit status of the last command, if non-zero
+ `svn:` prefix is added appropriately.
+* The number of running background jobs, if non-zero.
+* The exit status of the last command, if non-zero.
You can set `PROMPT_COLOR`, `PROMPT_PREFIX`, and `PROMPT_SUFFIX` too, which all
-do about what you'd expect. `PROMPT_PREFIX` will appear after the `SHLVL` angle
-brackets.
+do about what you'd expect.
This is all managed within the `prompt` function. There's some mildly hacky
logic on `tput` codes included such that it should work correctly for most
@@ -204,8 +198,6 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include:
* `scp()` tries to detect forgotten hostnames in `scp(1)` command calls.
* `sudo()` forces `-H` for `sudo(8)` calls so that `$HOME` is never
preserved; I hate having `root`-owned files in my home directory.
-* `tmux()` changes the default command for `tmux(1)` to `attach-session -d`
- if a session exists, or creates a new session if one doesn't.
* `tree()` colorizes GNU `tree(1)` output if possible (without having
`LS_COLORS` set).
* `vim()` defines three functions to always use `vim(1)` as my `ex(1)`,
@@ -409,11 +401,12 @@ Installed by the `install-bin` target:
* `min(1df)` prints the minimum.
* `mode(1df)` prints the first encountered mode.
* `tot(1df)` totals the set.
-* Two quick-and-dirty HTML text node content encoding tools:
+* Three quick-and-dirty HTML tools:
* `htenc(1df)` encodes.
* `htdec(1df)` decodes.
+ * `htrec(1df)` wraps `a` tags around URLs.
* `ap(1df)` reads arguments for a given command from the standard input,
- prompting if appropriate
+ prompting if appropriate.
* `apf(1df)` prepends arguments to a command with ones read from a file,
intended as a framework for shell wrappers or functions.
* `ax(1df)` evaluates an awk expression given on the command line; this is
@@ -421,7 +414,7 @@ Installed by the `install-bin` target:
* `bcq(1df)` runs `bc(1)`, quieting it down if need be.
* `bel(1df)` prints a terminal bell character.
* `bl(1df)` generates a given number of blank lines.
-* `bp(1df)` runs `br(1df)` after prompting for an URL
+* `bp(1df)` runs `br(1df)` after prompting for an URL.
* `br(1df)` launches `$BROWSER`, or a more suitable application for an URL if
it knows of one.
* `ca(1df)` prints a count of its given arguments.
@@ -432,9 +425,9 @@ Installed by the `install-bin` target:
* `clog(1df)` is a tiny timestamped log system.
* `clrd(1df)` sets up a per-line file read, clearing the screen first.
* `clwr(1df)` sets up a per-line file write, clearing the screen before each
- line
+ line.
* `csmw(1df)` prints an English list of monospace-quoted words read from the
- input
+ input.
* `ddup(1df)` removes duplicate lines from unsorted input.
* `dmp(1df)` copies a pass(1) entry selected by `dmenu(1)` to the X
CLIPBOARD.
@@ -448,7 +441,7 @@ Installed by the `install-bin` target:
* `finc(1df)` counts the number of results returned from a set of given
`find(1)` conditions.
* `fnl(1df)` runs a command and saves its output and error into temporary
- files, printing their paths and line counts
+ files, printing their paths and line counts.
* `gms(1df)` runs a set of `getmailrc` files; does much the same thing as the
script `getmails` in the `getmail` suite, but runs the requests in parallel
and does up to three silent retries using `try(1df)`.
@@ -501,6 +494,8 @@ Installed by the `install-bin` target:
`scp(1)`'s HOST:PATH format.
* `td(1df)` manages a to-do file for you with `$EDITOR` and `git(1)`; I used
to use Taskwarrior, but found it too complex and buggy.
+* `tm()` runs `tmux(1)` with `attach-session -d` if a session exists, and
+ `new-session` if it doesn't.
* `try(1df)` repeats a command up to a given number of times until it
succeeds, only printing error output if all three attempts failed. Good for
tolerating blips or temporary failures in `cron(8)` scripts.
@@ -511,6 +506,9 @@ Installed by the `install-bin` target:
* `vest(1df)` runs `test(1)` but fails with explicit output via `vex(1df)`.
* `vex(1df)` runs a command and prints `true` or `false` explicitly to
`stdout` based on the exit value.
+* `xrbg(1df)` applies the same randomly-selected background to each X screen.
+* `xrq(1df)` gets the values of specific resources out of `xrdb -query`
+ output.
There's some silly stuff in `install-games`:
diff --git a/X/xbindkeysrc b/X/xbindkeysrc
index 00855b09..16ae5b14 100644
--- a/X/xbindkeysrc
+++ b/X/xbindkeysrc
@@ -1,6 +1,15 @@
"exec urxvtcd"
Mod4 + Return
+"exec urxvtcd -e sh"
+ Mod4 + Control + Return
+
+"exec urxvtcd -e ksh"
+ Mod4 + Shift + Return
+
+"exec urxvtcd -e zsh"
+ Mod4 + Alt + Return
+
"exec br"
Mod4 + b
@@ -13,6 +22,9 @@
"exec gimp"
Mod4 + i
+"exec urxvtcd -e tm"
+ Mod4 + m
+
"exec dmp"
Mod4 + p
diff --git a/X/xinitrc b/X/xinitrc
index e0b3d661..6f2ad45f 100644
--- a/X/xinitrc
+++ b/X/xinitrc
@@ -1,3 +1,6 @@
+# If a file ~/.xrandrrc exists for monitor setup, source that first
+[ -e "$HOME"/.xrandrrc ] && . "$HOME"/.xrandrrc
+
# Read X resources
xrdb "$HOME"/.Xresources
diff --git a/X/xinitrc.d/shlvl.sh b/X/xinitrc.d/shlvl.sh
deleted file mode 100644
index 0e3bad04..00000000
--- a/X/xinitrc.d/shlvl.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-# Reset SHLVL
-unset SHLVL
diff --git a/X/xinitrc.d/xbackground.sh b/X/xinitrc.d/xbackground.sh
deleted file mode 100644
index 7f2bc8c3..00000000
--- a/X/xinitrc.d/xbackground.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-# Apply a random background image
-command -v feh >/dev/null 2>&1 || return
-feh --bg-scale --no-fehbg --randomize -- "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}"
diff --git a/X/xinitrc.d/xbindkeys.sh b/X/xinitrc.d/xbindkeys.sh
index a21bd995..b76aebdd 100644
--- a/X/xinitrc.d/xbindkeys.sh
+++ b/X/xinitrc.d/xbindkeys.sh
@@ -1,3 +1,3 @@
# Start xbindkeys(1)
command -v xbindkeys >/dev/null 2>&1 || return
-xbindkeys -n &
+(cd -- "$HOME" && xbindkeys -n) &
diff --git a/X/xinitrc.d/xrbg.sh b/X/xinitrc.d/xrbg.sh
new file mode 100644
index 00000000..0e4ec278
--- /dev/null
+++ b/X/xinitrc.d/xrbg.sh
@@ -0,0 +1,2 @@
+# Apply a random background image
+xrbg
diff --git a/bash/bash_completion.d/path.bash b/bash/bash_completion.d/path.bash
index e0e7732d..a65e10ce 100644
--- a/bash/bash_completion.d/path.bash
+++ b/bash/bash_completion.d/path.bash
@@ -49,7 +49,7 @@ _path() {
local part
for part in "${promptarr[@]}" ; do
[[ $part == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue
- COMPREPLY[${#COMPREPLY[@]}]=$(printf '%q\0' "$part")
+ COMPREPLY[${#COMPREPLY[@]}]=$(printf '%q' "$part")
done
;;
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 123c4146..b22f118f 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -28,12 +28,6 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > symbols to show nested shells
- local shlvl
- for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
- PS1='>'$PS1
- done
-
# Declare variables to contain terminal control strings
local format reset
@@ -110,7 +104,7 @@ prompt() {
git describe --tags --exact-match HEAD ||
git rev-parse --short HEAD
) || return
- name=${name##*/}
+ name=${name#refs/*/}
[[ -n $name ]] || return
# Check various files in .git to flag processes
diff --git a/bin/htref.sed b/bin/htref.sed
new file mode 100644
index 00000000..f2e943ca
--- /dev/null
+++ b/bin/htref.sed
@@ -0,0 +1,2 @@
+# Quick-and-dirty HTML linkifier
+s_https*://[^ \t<>]*_<a href="&">&</a>_
diff --git a/bin/pph b/bin/pph
index 684aaafd..7987382f 100755
--- a/bin/pph
+++ b/bin/pph
@@ -1,5 +1,5 @@
#!/bin/sh
# Run pp(1df) on args, prefix with machine hostname
-hostname=$(hostname -s) || exit
+hn=$(hostname -s) || exit
pp "$@" |
-sed 's_^_'"$hostname":'_'
+awk -v hn="$hn" '{ print hn ":" $0 }'
diff --git a/bin/rfcf b/bin/rfcf
index 633eaace..6f257415 100755
--- a/bin/rfcf
+++ b/bin/rfcf
@@ -1,11 +1,12 @@
#!/bin/sh
-# Figure out RFC number
-self=rfcf
-if ! [ "$1" ] ; then
- printf >&2 '%s: Need an RFC number\n' "$self"
+# Check arguments
+if [ "$#" -ne 1 ] ; then
+ printf >&2 'rfcf: Need one RFC number\n'
exit 2
fi
+
+# Argument is RFC number
rn=$1
# Retrieve the RFC with curl(1)
diff --git a/bin/rfcr b/bin/rfcr
index 03de898d..75d9abb0 100755
--- a/bin/rfcr
+++ b/bin/rfcr
@@ -1,11 +1,12 @@
#!/bin/sh
-# Figure out RFC number
-self=rfcr
-if ! [ "$1" ] ; then
- printf >&2 '%s: Need an RFC number\n' "$self"
+# Check arguments
+if [ "$#" -ne 1 ] ; then
+ printf >&2 'rfcf: Need one RFC number\n'
exit 2
fi
+
+# Argument is RFC number
rn=$1
# Retrieve the RFC with rfcf(1df)
diff --git a/bin/sd2u.awk b/bin/sd2u.awk
index 87f710b2..02584952 100644
--- a/bin/sd2u.awk
+++ b/bin/sd2u.awk
@@ -1,3 +1,3 @@
# Convert DOS line endings to UNIX ones
{ sub(/\r$/, "") }
-1
+{ print }
diff --git a/bin/su2d.awk b/bin/su2d.awk
index f9160ab0..34a8c5ae 100644
--- a/bin/su2d.awk
+++ b/bin/su2d.awk
@@ -1,3 +1,3 @@
# Convert UNIX line endings to DOS ones
!/\r$/ { $0 = $0 "\r" }
-1
+{ print }
diff --git a/bin/tm b/bin/tm
new file mode 100755
index 00000000..f2b51c63
--- /dev/null
+++ b/bin/tm
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Attach to existing tmux session rather than create a new one if possible
+
+# If given any arguments, just use them as they are
+if [ "$#" -gt 0 ] ; then
+ :
+
+# If a session exists, just attach to it
+elif command tmux has-session 2>/dev/null ; then
+ set -- attach-session -d
+
+# Create a new session with an appropriate name
+else
+ set -- new-session -s "${TMUX_SESSION:-default}"
+fi
+
+# Execute with concluded arguments
+tmux "$@"
diff --git a/bin/vest b/bin/vest
index d80c24d1..f857d8c1 100755
--- a/bin/vest
+++ b/bin/vest
@@ -1,5 +1,5 @@
#!/bin/sh
-# Run a test(1) command a print a string to stdout showing pass/fail
+# Run a test(1) command and print a string to stdout showing pass/fail
if [ "$#" -eq 0 ] ; then
printf >&2 'vest: Need test(1) arguments\n'
exit 2
diff --git a/bin/xgo b/bin/xgo
index 46d90f2e..652d5a14 100755
--- a/bin/xgo
+++ b/bin/xgo
@@ -13,12 +13,12 @@ for url ; do (
case $url in
# If this is a GitHub or GitLab link, swap "blob" for "raw" to get the actual file
- *://github.com/*/blob/*|*://gitlab.com/*/blob/*)
+ (*://github.com/*/blob/*|*://gitlab.com/*/blob/*)
url=$(printf '%s\n' "$url" | sed 's_/blob/_/raw/_')
;;
# Dig out the plain text for pastebin.com links
- *://pastebin.com/*)
+ (*://pastebin.com/*)
# shellcheck disable=SC2016
url=$(printf '%s\n' "$url" | sed 's_/[A-Za-z0-9][A-Za-z0-9]*$_/raw&_')
;;
@@ -26,14 +26,14 @@ for url ; do (
# If this is a not-direct imgur link and not to an album, swap URL
# elements to get to the actual file (it may not actually be a JPEG;
# the MIME type will tell us)
- *://imgur.com/a/*) ;;
- *://imgur.com/*)
+ (*://imgur.com/a/*) ;;
+ (*://imgur.com/*)
url=$(printf '%s\n' "$url" | sed 's_imgur\.com_i.imgur.com_;s/$/.jpg/')
;;
# If this is a YouTube video without a given start time, load it in mpv(1)
- *[/.]youtube.com/watch*[?\&]t=) ;;
- *[/.]youtube.com/watch*)
+ (*[/.]youtube.com/watch*[?\&]t=) ;;
+ (*[/.]youtube.com/watch*)
mpv -- "$url" && exit
;;
esac
@@ -46,7 +46,7 @@ for url ; do (
# Open PDFs in xpdf(1); download them first as xpdf(1) does not seem to
# have a way to handle stdin files
- application/pdf)
+ (application/pdf)
(
cd -- "$HOME"/Downloads || exit
curl -O -- "$url" || exit
@@ -56,18 +56,18 @@ for url ; do (
# Open audio and video in mpv(1); force a window even for audio so I
# can control it
- audio/*|video/*)
+ (audio/*|video/*)
mpv --force-window -- "$url" && exit
;;
# If the MIME type is an image that is not a GIF, load it in feh(1)
- image/gif) ;;
- image/*)
+ (image/gif) ;;
+ (image/*)
curl -- "$url" | feh - && exit
;;
# Open plain text in a terminal view(1)
- text/plain)
+ (text/plain)
# shellcheck disable=SC2016
urxvt -e sh -c 'curl -- "$1" | view -' _ "$url" && exit
;;
diff --git a/bin/xrbg b/bin/xrbg
new file mode 100755
index 00000000..801bf078
--- /dev/null
+++ b/bin/xrbg
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Apply a random background image. Requires rndf(1df) and feh(1).
+bg=$(rndf "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}") || exit
+feh --bg-scale --no-fehbg -- "$bg"
diff --git a/bin/xrq.awk b/bin/xrq.awk
new file mode 100644
index 00000000..5c9f7e96
--- /dev/null
+++ b/bin/xrq.awk
@@ -0,0 +1,27 @@
+# Run xrdb(1) to query specific resources from it
+# I thought xrdb -query would do this, but it doesn't seem to, maybe I'm doing
+# it wrong
+BEGIN {
+
+ # Separator is a colon followed by a tab
+ FS = ":\t"
+
+ # Check we have at least one resource name
+ if (ARGC < 2) {
+ print "xrq: Need at least one resource name" | "cat 1>&2"
+ exit(2)
+ }
+
+ # Run `xrdb -query` and search for instances of the requested resource
+ while ("xrdb -query" | getline) {
+ for (i in ARGV) {
+ if ($1 == ARGV[i]) {
+ found = 1
+ print $2
+ }
+ }
+ }
+
+ # Exit successfully if we found at least one result
+ exit(!found)
+}
diff --git a/i3/config b/i3/config
index b7c5dd5b..3c063c94 100644
--- a/i3/config
+++ b/i3/config
@@ -7,6 +7,9 @@ font pango:Verdana 7
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
+# No title bar
+new_window 1pixel
+
# Mod+Shift+r restarts i3wm
bindsym $mod+Shift+r restart
diff --git a/ksh/kshrc.d/bind.ksh b/ksh/kshrc.d/bind.ksh
index 34cb5f5a..a1999731 100644
--- a/ksh/kshrc.d/bind.ksh
+++ b/ksh/kshrc.d/bind.ksh
@@ -1,28 +1,17 @@
-# Try to bind ^I to complete words and ^L to clear the screen
+# Try to bind tab to complete words and Ctrl-Alt-L to clear the screen
+# Already done in ksh93
case $KSH_VERSION in
- # ksh93 is lovely, but complex; rebind ^L so it does the same as Alt-^L
- *'93'*)
- keybd_trap() {
- # shellcheck disable=SC2154
- case ${.sh.edchar} in
- $'\f') .sh.edchar=$'\e\f' ;;
- esac
- }
- trap keybd_trap KEYBD
- ;;
-
# More straightforward with mksh; bind keys to the appropriate emacs mode
# editing commands
*'MIRBSD KSH'*)
bind '^I'='complete'
- bind '^L'='clear-screen'
;;
# Similar with pdksh; there's a "complete" command, but not a "clear" one,
# so we fake it with clear(1) and some yanking
*'PD KSH'*)
bind '^I'='complete'
- bind -m '^L'='^Uclear^J^Y'
+ bind -m '^[^L'='^Uclear^J^Y'
;;
esac
diff --git a/ksh/kshrc.d/prompt.ksh b/ksh/kshrc.d/prompt.ksh
index 84129efc..bf77f626 100644
--- a/ksh/kshrc.d/prompt.ksh
+++ b/ksh/kshrc.d/prompt.ksh
@@ -28,14 +28,6 @@ function prompt {
# Add terminating "$" or "#" sign
PS1=$PS1'\$'
- # Add > symbols to show nested shells
- typeset shlvl
- shlvl=1
- while ((shlvl < SHLVL)); do
- PS1='>'$PS1
- ((shlvl++))
- done
-
# Declare variables to contain terminal control strings
typeset format reset
@@ -108,7 +100,7 @@ function prompt {
git describe --tags --exact-match HEAD ||
git rev-parse --short HEAD
) || return
- name=${name##*/}
+ name=${name#refs/*/}
[[ -n $name ]] || return
# Check various files in .git to flag processes
diff --git a/man/man1/htref.1df b/man/man1/htref.1df
new file mode 100644
index 00000000..922188dc
--- /dev/null
+++ b/man/man1/htref.1df
@@ -0,0 +1,20 @@
+.TH HTREF 1df "January 2017" "Manual page for htref"
+.SH NAME
+.B htref
+\- turn URLs into HTML links
+.SH SYNOPSIS
+htenc urls |
+.B htref
+| nlbr > urls.html
+.SH DESCRIPTION
+.B htref
+looks for http:// and https:// URLs, and wraps <a href="..."> tags around them
+pointing to the same URL. HTML encoding of the URL should be done before this
+step.
+.P
+All characters that are not spaces, tabs, or angle brackets are included in the
+URL.
+.SH SEE ALSO
+htenc(1df)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/tm.1df b/man/man1/tm.1df
new file mode 100644
index 00000000..125d69c1
--- /dev/null
+++ b/man/man1/tm.1df
@@ -0,0 +1,12 @@
+.TH TM 1df "January 2017" "Manual page for tm"
+.SH NAME
+.B tm
+\- tmux shortcut
+.SH SYNOPSIS
+.B tm
+.SH DESCRIPTION
+If arguments are given, pass them to tmux(1) unchanged. If not, check if a tmux
+session exists; if it does, attach to it. If not, create a new session with
+name given in environment variable $TMUX_SESSION, default "default".
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/xrbg.1df b/man/man1/xrbg.1df
new file mode 100644
index 00000000..481c9185
--- /dev/null
+++ b/man/man1/xrbg.1df
@@ -0,0 +1,19 @@
+.TH XRBG 1df "March 2016" "Manual page for xrbg"
+.SH NAME
+.B xrbg
+\- apply a random X background image with feh(1)
+.SH SYNOPSIS
+.B xrbg
+.br
+XBACKGROUNDS=/path/to/images
+.B xrbg
+.SH DESCRIPTION
+.B xrbg
+searches for images in the directory named in the XBACKGROUNDS environment
+variable (defaults to ~/.xbackgrounds), chooses a random one with rndf(1df),
+and applies it with feh(1). It's designed for use in ~/.xinitrc, but it seems
+to work when called manually from within an X session too.
+.SH SEE ALSO
+feh(1), rndf(1df)
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man1/xrq.1df b/man/man1/xrq.1df
new file mode 100644
index 00000000..d0bdeeb3
--- /dev/null
+++ b/man/man1/xrq.1df
@@ -0,0 +1,16 @@
+.TH XRQ 1df "January 2017" "Manual page for xrq"
+.SH NAME
+.B xrq
+\- query X resource values
+.SH SYNOPSIS
+.B xrq
+Xft.hintstyle
+.br
+.B xrq
+URxvt.color0 URxvt.color9
+.SH DESCRIPTION
+.B xrq
+runs xrdb(1) with the -query option and filters for the values of the named
+keys. It exits successfully if at least one of the named keys was found.
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/readline/inputrc b/readline/inputrc
index 5254656e..7e4b500d 100644
--- a/readline/inputrc
+++ b/readline/inputrc
@@ -62,6 +62,9 @@ $if Bash
# Alt+A cycles through completion options
"\ea": menu-complete
+ # Ctrl-Alt-L to clear screen; more ksh-like
+ "\e\C-l": clear-screen
+
# Alt-E (for exec) to prepend "exec " to a command and return to the end of
# the line
"\ee": "\C-aexec \C-e"
@@ -71,8 +74,8 @@ $if Bash
# Alt-S (for set) to wrap current command in (set -x ; ...)
"\es": "\C-a(set -x ; \C-e)\C-b"
- # Alt-M (for muxer) to run tmux
- "\em": "\C-utmux\C-j\C-y"
+ # Alt-M (for muxer) to run tm(1df)
+ "\em": "\C-utm\C-j\C-y"
# Ctrl-Alt-B to move backward a shell-quoted word
"\e\C-b": shell-backward-word
diff --git a/sh/profile.d/lang.sh b/sh/profile.d/lang.sh
new file mode 100644
index 00000000..21f67d5b
--- /dev/null
+++ b/sh/profile.d/lang.sh
@@ -0,0 +1,4 @@
+# Always use bytewise sorting if not already set
+[ -z "$LC_COLLATE" ] || return
+LC_COLLATE=C
+export LC_COLLATE
diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh
index aa7e9ace..345888d0 100644
--- a/sh/profile.d/options.sh
+++ b/sh/profile.d/options.sh
@@ -46,12 +46,9 @@ options grep \
# Cache options for ls(1)
options ls \
- almost-all \
- block-size \
- classify \
- color \
- format \
- hide-control-chars \
- human-readable \
+ almost-all \
+ block-size \
+ color \
+ human-readable \
time-style
)
diff --git a/sh/shrc.d/gd.sh b/sh/shrc.d/gd.sh
index 5a3f54b0..fa5776f2 100644
--- a/sh/shrc.d/gd.sh
+++ b/sh/shrc.d/gd.sh
@@ -10,7 +10,7 @@ gd() {
# Complain if mark not actually set yet
if ! [ -n "$PMD" ] ; then
printf >&2 'gd(): Mark not set\n'
- return 2
+ return 1
fi
# Go to the marked directory
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index a52b6f90..fc8f62c0 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -2,6 +2,9 @@
# options for us; if not, we won't be wrapping grep(1) with a function at all
[ -d "$HOME"/.cache/grep ] || return
+# Discard GNU grep(1) environment variables if the environment set them
+unset -v GREP_OPTIONS
+
# Define function proper
grep() {
diff --git a/sh/shrc.d/less.sh b/sh/shrc.d/less.sh
new file mode 100644
index 00000000..2778ce65
--- /dev/null
+++ b/sh/shrc.d/less.sh
@@ -0,0 +1,2 @@
+# Unset stupid env vars to avoid interfering with my less(1) setup
+unset -v LESS LESSOPEN
diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh
index 7e916239..58263e96 100644
--- a/sh/shrc.d/ls.sh
+++ b/sh/shrc.d/ls.sh
@@ -2,34 +2,32 @@
# options for us; if not, we won't be wrapping ls(1) with a function at all
[ -d "$HOME"/.cache/ls ] || return
+# If the system has already aliased ls(1) for us, like Slackware or OpenBSD
+# does, just get rid of it
+unalias ls >/dev/null 2>&1
+
+# Discard GNU ls(1) environment variables if the environment set them
+unset -v LS_OPTIONS LS_COLORS
+
# Define function proper
ls() {
+ # -F to show trailing indicators of the filetype
+ # -q to replace control chars with '?'
+ # -x to format entries across, not down
+ set -- -Fqx "$@"
+
# Add --block-size=K to always show the filesize in kibibytes
[ -e "$HOME"/.cache/ls/block-size ] &&
set -- --block-size=1024 "$@"
- # Add --classify to show trailing indicators of the filetype
- [ -e "$HOME"/.cache/ls/classify ] &&
- set -- --classify "$@"
-
# Add --color if the terminal has at least 8 colors
[ -e "$HOME"/.cache/ls/color ] &&
[ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] &&
set -- --color=auto "$@"
- # Add --format=horizontal to print entries in a saner way
- [ -e "$HOME"/.cache/ls/format ] &&
- set -- --format=horizontal "$@"
-
- # Add --hide-control-chars if present; we always want this interactively,
- # even if the output is to a pager; we shouldn't be trying to script ls(1)
- # output anyway
- [ -e "$HOME"/.cache/ls/hide-control-chars ] &&
- set -- --hide-control-chars "$@"
-
# Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred
- # format
+ # (fixed) format
[ -e "$HOME"/.cache/ls/time-style ] &&
set -- --time-style='+%Y-%m-%d %H:%M:%S' "$@"
diff --git a/sh/shrc.d/md.sh b/sh/shrc.d/md.sh
index 6fd3d7ca..a7134931 100644
--- a/sh/shrc.d/md.sh
+++ b/sh/shrc.d/md.sh
@@ -7,11 +7,14 @@ md() {
return 2
fi
- # If first arg unset or empty, assume the user means the current dir
- [ -n "$1" ] || set -- "$PWD"
-
- # Jump to the dir and emit PWD from a subshell to get an absolute path
- set -- "$(cd -- "$1" && printf %s "$PWD")"
+ # If argument given, change to it in subshell to get absolute path.
+ # If not, use current working directory.
+ if [ -n "$1" ] ; then
+ set -- "$(cd -- "$1" && printf '%s/' "$PWD")"
+ set -- "${1%%/}"
+ else
+ set -- "$PWD"
+ fi
# If that turned up empty, we have failed; the cd call probably threw an
# error for us too
diff --git a/sh/shrc.d/path.sh b/sh/shrc.d/path.sh
index 3caabbc9..23eec75b 100644
--- a/sh/shrc.d/path.sh
+++ b/sh/shrc.d/path.sh
@@ -24,10 +24,28 @@ path() {
done
) ;;
+ # Helper function checks directory argument makes sense
+ _argcheck)
+ shift
+ if [ "$#" -gt 2 ] ; then
+ printf >&2 'path(): %s: too many arguments\n' "$1"
+ return 2
+ fi
+ case $2 in
+ *:*)
+ printf >&2 'path(): %s: %s contains colon\n' "$@"
+ return 2
+ ;;
+ esac
+ return 0
+ ;;
+
# Add a directory at the start of $PATH
insert)
+ [ "$#" -eq 2 ] || set -- "$1" "$PWD"
+ path _argcheck "$@" || return
if path check "$2" ; then
- printf >&2 'path(): %s already in PATH\n' "$2"
+ printf >&2 'path(): %s: %s already in PATH\n' "$@"
return 1
fi
PATH=${2}${PATH:+:"$PATH"}
@@ -35,8 +53,10 @@ path() {
# Add a directory to the end of $PATH
append)
+ [ "$#" -eq 2 ] || set -- "$1" "$PWD"
+ path _argcheck "$@" || return
if path check "$2" ; then
- printf >&2 'path(): %s already in PATH\n' "$2"
+ printf >&2 'path(): %s: %s already in PATH\n' "$@"
return 1
fi
PATH=${PATH:+"$PATH":}${2}
@@ -44,21 +64,25 @@ path() {
# Remove a directory from $PATH
remove)
+ [ "$#" -eq 2 ] || set -- "$1" "$PWD"
+ path _argcheck "$@" || return
if ! path check "$2" ; then
- printf >&2 'path(): %s not in PATH\n' "$2"
+ printf >&2 'path(): %s: %s not in PATH\n' "$@"
return 1
fi
PATH=$(
path=:$PATH:
path=${path%%:"$2":*}:${path#*:"$2":}
path=${path#:}
- path=${path%:}
- printf '%s\n' "$path"
+ printf '%s:' "$path"
)
+ PATH=${PATH%%:}
;;
# Check whether a directory is in PATH
check)
+ path _argcheck "$@" || return
+ [ "$#" -eq 2 ] || set -- "$1" "$PWD"
case :$PATH: in
*:"$2":*) return 0 ;;
esac
@@ -73,23 +97,22 @@ path(): Manage contents of PATH variable
USAGE:
path [list]
Print the current directories in PATH, one per line (default command)
- path insert DIR
- Add a directory to the front of PATH
- path append DIR
- Add a directory to the end of PATH
- path remove DIR
- Remove directory from PATH
- path check DIR
- Return whether DIR is a component of PATH
+ path insert [DIR]
+ Add directory DIR (default $PWD) to the front of PATH
+ path append [DIR]
+ Add directory DIR (default $PWD) to the end of PATH
+ path remove [DIR]
+ Remove directory DIR (default $PWD) from PATH
+ path check [DIR]
+ Return whether directory DIR (default $PWD) is a component of PATH
path help
- Print this help message (also done if command not found)
+ Print this help message
EOF
;;
# Command not found
*)
- printf >&2 'path(): Unknown command\n'
- path help >&2
+ printf >&2 'path(): %s: Unknown command (try "help")\n' "$1"
return 2
;;
esac
diff --git a/sh/shrc.d/pmd.sh b/sh/shrc.d/pmd.sh
index 03f18b7b..c96a50bd 100644
--- a/sh/shrc.d/pmd.sh
+++ b/sh/shrc.d/pmd.sh
@@ -2,7 +2,7 @@
pmd() {
if ! [ -n "$PMD" ] ; then
printf >&2 'pmd(): Mark not set\n'
- return 2
+ return 1
fi
printf '%s\n' "$PMD"
}
diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh
new file mode 100644
index 00000000..a481b5bb
--- /dev/null
+++ b/sh/shrc.d/prompt.sh
@@ -0,0 +1,5 @@
+# Some systems' /etc/profile setups export PS1, which really fouls things up
+# when switching between non-login shells; let's put things right by unsetting
+# it to break the export and then just setting them as simple variables
+unset PS1 PS2 PS3 PS4
+PS1='$ ' PS2='> ' PS3='? ' PS4='+ '
diff --git a/sh/shrc.d/tmux.sh b/sh/shrc.d/tmux.sh
deleted file mode 100644
index bd954be8..00000000
--- a/sh/shrc.d/tmux.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-# Attach to existing tmux session rather than create a new one if possible
-tmux() {
-
- # If given any arguments, just use them as they are
- if [ "$#" -gt 0 ] ; then
- :
-
- # If a session exists, just attach to it
- elif command tmux has-session 2>/dev/null ; then
- set -- attach-session -d
-
- # Create a new session with an appropriate name
- else
- set -- new-session -s "${TMUX_SESSION:-default}"
- fi
-
- # Execute with concluded arguments
- command tmux "$@"
-}
diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh
index 1902e3ba..8b35357c 100644
--- a/sh/shrc.d/vr.sh
+++ b/sh/shrc.d/vr.sh
@@ -19,10 +19,16 @@ vr() {
cd -- "$path" || exit
# Ask Git the top level (good)
- git rev-parse --show-toplevel 2>/dev/null && exit
+ if git rev-parse --show-toplevel 2>/dev/null ; then
+ printf /
+ exit
+ fi
# Ask Mercurial the top level (great)
- hg root 2>/dev/null && exit
+ if hg root 2>/dev/null ; then
+ printf /
+ exit
+ fi
# If we can get SVN info, iterate upwards until we cannot; hopefully
# that is the root (bad)
@@ -32,7 +38,7 @@ vr() {
cd .. || exit
done
if [ -n "$root" ] ; then
- printf '%s\n' "$root"
+ printf '%s\n/' "$root"
exit
fi
@@ -41,6 +47,9 @@ vr() {
exit 1
)"
+ # Chop the trailing newline and slash
+ set -- "${1%?/}"
+
# Check we figured out a target, or bail
[ -n "$1" ] || return
diff --git a/sh/shrc.d/xd.sh b/sh/shrc.d/xd.sh
index 01b8fd3a..40319cf2 100644
--- a/sh/shrc.d/xd.sh
+++ b/sh/shrc.d/xd.sh
@@ -10,7 +10,7 @@ xd() {
# Complain if mark not actually set yet
if ! [ -n "$PMD" ] ; then
printf >&2 'gd(): Mark not set\n'
- return 2
+ return 1
fi
# Put the current and marked directories into positional params
diff --git a/tmux/tmux.conf.m4 b/tmux/tmux.conf.m4
index 9f1aa80f..4e3cce4d 100644
--- a/tmux/tmux.conf.m4
+++ b/tmux/tmux.conf.m4
@@ -8,16 +8,12 @@ set-environment -gru SSH_CONNECTION
set-environment -gru SSH_TTY
set-environment -gru WINDOWID
-# Reset SHLVL
-set-environment -gru SHLVL
-
# Otherwise, use the environment we had when we started; don't touch it during
# a session unless I specifically ask
set-option -g update-environment ''
# Setting this makes each new pane a non-login shell, which suits me better
-# Clear away SHLVL again first to stop it getting incremented twice
-set-option -g default-command "unset SHLVL ; exec $SHELL"
+set-option -g default-command "$SHELL"
# Expect a 256-color terminal
set-option -g default-terminal 'screen-256color'
@@ -116,17 +112,16 @@ set-option -g message-style "bg=colour18,fg=colour231"
# Window choosers are white on blue
set-window-option -g mode-style "bg=colour18,fg=colour231"
-# Pane borders are always in dark gray
-set-option -g pane-border-style "fg=TMUX_COLOR"
-set-option -g pane-active-border-style "fg=TMUX_COLOR"
+# Pane borders are always in the background color
+set-option -g pane-border-style "fg=TMUX_BG"
+set-option -g pane-active-border-style "fg=TMUX_BG"
-# Inactive windows have a slightly grayed-out background and default text
+# Inactive windows have slightly washed-out system colours
set-option -g window-style "bg=colour232,fg=colour248"
set-option -g window-active-style "bg=colour0,fg=colour15"
-# The status bar defaults to light gray on dark gray, which applies to the left
-# and right status bar sections described in status-left and status-right above
-set-option -g status-style "bg=TMUX_COLOR,fg=colour248"
+# The status bar has the defined background and foreground colours
+set-option -g status-style "bg=TMUX_BG,fg=TMUX_FG"
# Titles of windows default to black text with no embellishment
set-window-option -g window-status-style "fg=colour16"
diff --git a/vim/after/ftdetect/xdefaults.vim b/vim/after/ftdetect/xdefaults.vim
new file mode 100644
index 00000000..f0ee7b81
--- /dev/null
+++ b/vim/after/ftdetect/xdefaults.vim
@@ -0,0 +1,6 @@
+" Add automatic commands to find Xresources subfiles
+augroup dfxdefaults
+ autocmd BufNewFile,BufRead
+ \ **/.Xresources.d/*
+ \ setlocal filetype=xdefaults
+augroup END
diff --git a/vim/bundle/html5 b/vim/bundle/html5
-Subproject 93144aea5adee78e008be4d3c8a40a84bc22138
+Subproject 21ce415bd93225c3b10010b650652f07dd22912
diff --git a/vim/bundle/lion b/vim/bundle/lion
-Subproject 9b1a923d51a7d0a8efdbb2289ce1e763038f965
+Subproject 08d5e714e87305c4b42f17db373af8244293e42
diff --git a/wyrd/wyrdrc b/wyrd/wyrdrc
deleted file mode 100644
index 86eae455..00000000
--- a/wyrd/wyrdrc
+++ /dev/null
@@ -1,167 +0,0 @@
-# Wyrd run-configuration file
-
-# command for the Remind executable
-set remind_command="remind"
-# the default reminder file to display
-set reminders_file="$HOME/.reminders"
-# command for editing an old appointment, given a line number %line% and filename %file%
-set edit_old_command="${VISUAL:-$EDITOR} +%line% %file%"
-# command for editing a new appointment, given a filename %file%
-set edit_new_command="${VISUAL:-$EDITOR} +999999 %file%"
-# command for free editing of the reminders file, given a filename %file%
-set edit_any_command="${VISUAL:-$EDITOR} %file%"
-
-
-# templates for creating new appointments
-# %monname% -> month name, %mon% -> month number, %mday% -> day of the month,
-# %year% -> year, %hour% -> hour, %min% -> minute, %wdayname% -> weekday name
-# %wday% -> weekday number
-set timed_template="REM %monname% %mday% %year% AT %hour%:%min% DURATION 1:00 MSG "
-set untimed_template="REM %monname% %mday% %year% MSG "
-
-# weekly recurrence
-set template0="REM %wdayname% AT %hour%:%min% DURATION 1:00 MSG "
-set template1="REM %wdayname% MSG "
-
-# monthly recurrence
-set template2="REM %mday% AT %hour%:%min% DURATION 1:00 MSG "
-set template3="REM %mday% MSG "
-
-
-# algorithm to use for determining busy level
-# "1" -> count the number of reminders in each day
-# "2" -> count the number of hours of reminders in each day
-set busy_algorithm="1"
-# for busy_algorithm="2", assume that untimed reminders occupy this many minutes
-set untimed_duration="60"
-
-# if busy_algorithm="1", number of reminders per day allowed for each calendar
-# colorization level; if busy_algorithm="2", use number of hours of reminders
-# per day
-set busy_level1="1" # level1 color
-set busy_level2="3" # level2 color
-set busy_level3="5" # level2 color, bold
-set busy_level4="7" # level3 color
- # (everything else is level3 color, bold)
-
-
-# first day of the week is Monday
-set week_starts_monday="true"
-
-# 12/24 hour time settings
-set schedule_12_hour="false"
-set selection_12_hour="true"
-set status_12_hour="true"
-set description_12_hour="true"
-
-# whether or not to keep the cursor centered when scrolling through timed
-# reminders
-set center_cursor="false"
-
-# date syntax for the 'go to date' command can be big or little endian
-set goto_big_endian="true"
-# date syntax for the "quick reminder" command can be US style
-# (6/1 -> June 1) or non-US style (6/1 -> January 6)
-set quick_date_US="false"
-
-# whether or not to number weeks within the month calendar
-set number_weeks="false"
-
-# whether or not the cursor should follow the current time
-# after pressing the "home" key
-set home_sticky="true"
-
-# whether or not to display advance warnings
-set advance_warning="false"
-
-# width of the untimed reminders window
-set untimed_window_width="40"
-
-# whether or not to render untimed reminders in boldface
-set untimed_bold="true"
-
-
-# key bindings
-bind "j" scroll_down
-bind "<down>" scroll_down
-bind "k" scroll_up
-bind "<up>" scroll_up
-bind "h" switch_window
-bind "l" switch_window
-bind "<left>" switch_window
-bind "<right>" switch_window
-bind "<pageup>" previous_day
-bind "4" previous_day
-bind "<" previous_day
-bind "H" previous_day
-bind "<pagedown>" next_day
-bind "6" next_day
-bind ">" next_day
-bind "L" next_day
-bind "8" previous_week
-bind "[" previous_week
-bind "K" previous_week
-bind "2" next_week
-bind "]" next_week
-bind "J" next_week
-bind "{" previous_month
-bind "}" next_month
-bind "<home>" home
-bind "g" goto
-bind "z" zoom
-bind "<return>" edit
-bind "<enter>" edit
-bind "e" edit_any
-bind "y" copy
-bind "X" cut
-bind "p" paste
-bind "P" paste_dialog
-bind "d" scroll_description_up
-bind "D" scroll_description_down
-#bind "q" quick_add
-bind "t" new_timed
-bind "T" new_timed_dialog
-bind "u" new_untimed
-bind "U" new_untimed_dialog
-bind "w" new_template0
-bind "W" new_template1
-bind "m" new_template2
-bind "M" new_template3
-bind "n" search_next
-bind "/" begin_search
-bind "<tab>" next_reminder
-bind "r" view_remind
-bind "R" view_remind_all
-bind "c" view_week
-bind "C" view_month
-bind "?" help
-bind "\\Cl" refresh
-#bind "Q" quit
-bind "q" quit
-
-bind "<return>" entry_complete
-bind "<enter>" entry_complete
-bind "<backspace>" entry_backspace
-bind "<esc>" entry_cancel
-
-
-# set up the colors
-color help white magenta
-color timed_default white black
-color timed_current white magenta
-color timed_reminder1 white blue
-color timed_reminder2 white red
-color timed_reminder3 white green
-color timed_reminder4 yellow magenta
-color untimed_reminder white black
-color timed_date magenta black
-color selection_info white magenta
-color description white black
-color status white magenta
-color calendar_labels white black
-color calendar_level1 white black
-color calendar_level2 magenta black
-color calendar_level3 red black
-color calendar_today magenta white
-color left_divider magenta magenta
-color right_divider magenta magenta
diff --git a/zsh/zshrc.d/completion.zsh b/zsh/zshrc.d/completion.zsh
new file mode 100644
index 00000000..233a1b91
--- /dev/null
+++ b/zsh/zshrc.d/completion.zsh
@@ -0,0 +1,19 @@
+# Use modern completion system
+autoload -Uz compinit
+compinit
+
+# Taken from Debian's stock .zshrc as a start
+zstyle ':completion:*' auto-description 'specify: %d'
+zstyle ':completion:*' completer _expand _complete _correct _approximate
+zstyle ':completion:*' format 'Completing %d'
+zstyle ':completion:*' group-name ''
+zstyle ':completion:*' menu select=2
+zstyle ':completion:*' list-colors ''
+zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
+zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
+zstyle ':completion:*' menu select=long
+zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
+zstyle ':completion:*' use-compctl false
+zstyle ':completion:*' verbose true
+zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
+zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
diff --git a/zsh/zshrc.d/prompt.zsh b/zsh/zshrc.d/prompt.zsh
index 898031ea..cfac7ffd 100644
--- a/zsh/zshrc.d/prompt.zsh
+++ b/zsh/zshrc.d/prompt.zsh
@@ -24,12 +24,6 @@ prompt() {
# Add terminating "$" or "#" sign
PS1=$PS1'%#'
- # Add > symbols to show nested shells
- local shlvl
- for ((shlvl = 1; shlvl < SHLVL; shlvl++)) ; do
- PS1='>'$PS1
- done
-
# Bold and color the prompt if it looks like we can
if (( $({ tput colors || tput Co ; } 2>/dev/null) >= 8 )) ; then
PS1='%B%F{cyan}'$PS1'%f%b'
@@ -73,7 +67,7 @@ prompt() {
git describe --tags --exact-match HEAD ||
git rev-parse --short HEAD
) || return
- name=${name##*/}
+ name=${name#refs/*/}
[[ -n $name ]] || return
# Check various files in .git to flag processes