aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ISSUES.markdown23
-rw-r--r--Makefile5
-rw-r--r--README.markdown19
-rw-r--r--bash/bashrc.d/prompt.bash37
-rwxr-xr-xbin/sshi6
-rw-r--r--git/gitconfig.m413
-rw-r--r--man/man1/dmp.19
-rw-r--r--man/man6/acq.63
-rw-r--r--pdksh/pdkshrc.d/prompt.pdksh42
-rw-r--r--sh/profile.d/grep.sh10
-rw-r--r--sh/shrc.d/grep.sh8
-rw-r--r--sh/shrc.d/sd.sh2
-rw-r--r--sh/shrc.d/vr.sh6
13 files changed, 114 insertions, 69 deletions
diff --git a/ISSUES.markdown b/ISSUES.markdown
index c9a832d1..7894c28d 100644
--- a/ISSUES.markdown
+++ b/ISSUES.markdown
@@ -1,8 +1,6 @@
Known issues
============
-* The terminfo files probably still do not work on NetBSD (needs retesting
- and manual page reading).
* man(1) completion doesn't work on OpenBSD as manpath(1) isn't a thing on
that system; need to find some way of finding which manual directories
should be searched at runtime, if there is one.
@@ -17,17 +15,12 @@ Known issues
git-reflog(1) cals
* The \xFF syntax for regex as used in rfct(1) is not POSIX. Need to decide
if it's well-supported enough to keep it anyway.
-* Git prompt seems to change its mind about file moves after a run of
- git-status:
+* On OpenBSD pdksh, including single quotes in comments within command
+ substitution throws "unclosed quote" errors in the linter checks:
- tom@conan:~/.dotfiles(master)$ git mv bash/bashrc.d/ud.bash sh/shrc.d/ud.sh
- tom@conan:~/.dotfiles(master!+)$ git diff --cached
- diff --git a/bash/bashrc.d/ud.bash b/sh/shrc.d/ud.sh
- similarity index 100%
- rename from bash/bashrc.d/ud.bash
- rename to sh/shrc.d/ud.sh
- tom@conan:~/.dotfiles(master!+)$
- tom@conan:~/.dotfiles(master!+)$
- tom@conan:~/.dotfiles(master!+)$ git status
- R bash/bashrc.d/ud.bash -> sh/shrc.d/ud.sh
- tom@conan:~/.dotfiles(master+)$
+ sh/shrc.d/vr.sh[50]: no closing quote
+ *** Error 1 in /home/tom/.dotfiles (Makefile:348 'check-sh')
+
+ Fixed for the instances I found, but it would be interesting to find
+ whether this is a bug in pdksh or whether it's a dark corner of the POSIX
+ standard.
diff --git a/Makefile b/Makefile
index 49304591..0c57d423 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,6 @@
install-readline \
install-sh \
install-subversion \
- install-terminfo \
install-tmux \
install-urxvt \
install-vim \
@@ -130,7 +129,6 @@ install : install-bash \
install-gnupg \
install-readline \
install-sh \
- install-terminfo \
install-vim
install-abook :
@@ -275,12 +273,11 @@ install-subversion :
install -pm 0644 -- subversion/config "$(HOME)"/.subversion/config
install-terminfo :
- command -v tic || exit 0
for info in terminfo/*.info ; do \
tic -- "$$info" ; \
done
-install-tmux : tmux/tmux.conf
+install-tmux : tmux/tmux.conf install-terminfo
install -pm 0644 -- tmux/tmux.conf "$(HOME)"/.tmux.conf
install-urxvt : check-urxvt
diff --git a/README.markdown b/README.markdown
index 4108914d..e17ddb68 100644
--- a/README.markdown
+++ b/README.markdown
@@ -98,14 +98,13 @@ they should work in most `sh(1)` implementations. Individual scripts called by
management. All of these boil down to exporting variables appropriate to the
system and the software it has available.
+I make an effort to target POSIX for my functions and scripts where I can, but
+Bash is my interactive shell of choice.
+
My `.bash_profile` calls `.profile`, and then `.bashrc`, which only applies for
interactive shells. Subscripts for `.bashrc` are loaded from `.bashrc.d`. The
-contents of the two directories changes depending on the host, so only specific
-scripts in it are versioned.
-
-My interactive and scripting shell of choice is Bash; as a GNU/Linux admin who
-ends up installing Bash on \*BSD machines anyway, I very rarely have to write
-Bourne-compatible scripts, so all of these files are replete with Bashisms.
+contents of the `*.d` directories changes depending on the host, so only
+specific scripts in it are versioned.
As I occasionally have work on very old internal systems, my Bash is written to
work with [any version 2.05a or
@@ -142,10 +141,10 @@ A terminal session with my prompt looks something like this:
It expands based on context to include these elements in this order:
-* Whether in a Git repository if applicable, and punctuation to show whether
- there are local modifications 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
+* 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
diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash
index 081cff69..1e8c568d 100644
--- a/bash/bashrc.d/prompt.bash
+++ b/bash/bashrc.d/prompt.bash
@@ -122,20 +122,35 @@ prompt() {
fi
branch=${branch##*/}
+ # Refresh index so e.g. git-diff-files(1) is accurate
+ git update-index --refresh >/dev/null
+
# Collect symbols representing repository state
local state
- if ! git diff-files --quiet ; then
- state=${state}!
- fi
- if ! git diff-index --cached --quiet HEAD ; then
- state=${state}+
- fi
- if [[ -n $(git ls-files --others --exclude-standard) ]] ; then
+
+ # Upstream HEAD has commits after local HEAD; we're "behind"
+ (($(git rev-list --count 'HEAD..@{u}' 2>/dev/null) > 0)) &&
+ state=${state}\<
+
+ # Local HEAD has commits after upstream HEAD; we're "ahead"
+ (($(git rev-list --count '@{u}..HEAD' 2>/dev/null) > 0)) &&
+ state=${state}\>
+
+ # Tracked files are modified
+ git diff-files --quiet ||
+ state=${state}\!
+
+ # Changes are staged
+ git diff-index --cached --quiet HEAD ||
+ state=${state}\+
+
+ # There are some untracked and unignored files
+ [[ -n $(git ls-files --others --exclude-standard) ]] &&
state=${state}\?
- fi
- if git rev-parse --quiet --verify refs/stash >/dev/null ; then
- state=${state}^
- fi
+
+ # There are stashed changes
+ git rev-parse --quiet --verify refs/stash >/dev/null &&
+ state=${state}\^
# Print the status in brackets; add a git: prefix only if there
# might be another VCS prompt (because PROMPT_VCS is set)
diff --git a/bin/sshi b/bin/sshi
index 2f11a61d..bf710b8a 100755
--- a/bin/sshi
+++ b/bin/sshi
@@ -4,7 +4,7 @@
# Check we have an SSH_CONNECTION variable
if [ -z "$SSH_CONNECTION" ] ; then
printf >&2 'sshi: SSH_CONNECTION appears empty\n'
- exit 2
+ exit 1
fi
# Print the two variables into a subshell so we can chop them up with read
@@ -17,8 +17,8 @@ printf '%s\n' "$SSH_CONNECTION" "${SSH_TTY:-unknown}" | (
read -r tty
# Try to resolve the client and server IPs
- ch=$(dig -x "$ci" +short 2>/dev/null | sed 1q)
- sh=$(dig -x "$si" +short 2>/dev/null | sed 1q)
+ ch=$(dig -x "$ci" +short 2>/dev/null | sed 's/\.$//;1q')
+ sh=$(dig -x "$si" +short 2>/dev/null | sed 's/\.$//;1q')
# Print the results in a human-readable format
printf "%s:%u -> %s:%u (%s)\n" \
diff --git a/git/gitconfig.m4 b/git/gitconfig.m4
index 73bdae98..d1aac5e8 100644
--- a/git/gitconfig.m4
+++ b/git/gitconfig.m4
@@ -1,6 +1,7 @@
[advice]
statusHints = false
detachedHead = false
+ implicitIdentity = false
pushUpdateRejected = false
[alias]
@@ -9,12 +10,23 @@
[color]
ui = true
+[commit]
+ status = false
+
+[core]
+ compression = 9
+
[diff]
+ algorithm = patience
tool = vimdiff
[difftool]
prompt = false
+[fetch]
+ output = compact
+ prune = true
+
[grep]
extendRegexp = true
lineNumber = true
@@ -38,6 +50,7 @@
[status]
short = true
+ showUntrackedFiles = all
[user]
name = DOTFILES_NAME
diff --git a/man/man1/dmp.1 b/man/man1/dmp.1
index e9b5dc4f..d5883afc 100644
--- a/man/man1/dmp.1
+++ b/man/man1/dmp.1
@@ -5,14 +5,15 @@
.SH SYNOPSIS
.B dmp
.br
-.B dmp 25
+.B dmp
+25
.SH DESCRIPTION
.B dmp
applies dmenu(1) to pick a password entry from a pass(1) store and put it into
-the X CLIPBOARD for up to 10 seconds.
+the X CLIPBOARD for a period of time, defaulting to 10 seconds, after which
+xsel(1) will remove it from the clipboard.
.P
-An optional timeout in seconds can be applied, after which xsel(1) will remove
-the password from the clipboard. This timeout defaults to 10 seconds.
+The timeout in seconds can be specified as an optional argument.
.SH SEE ALSO
dmenu(1), pass(1), xsel(1)
.SH AUTHOR
diff --git a/man/man6/acq.6 b/man/man6/acq.6
index 78bd6c0e..c3a94d27 100644
--- a/man/man6/acq.6
+++ b/man/man6/acq.6
@@ -10,8 +10,7 @@ How may the stars be prevented from going out?
.SH DESCRIPTION
.B acq
allows you to pose questions to AC, the interplanetary computer. Suggested
-topics include the inevitable fate of the universe and whether its ultimate
-destruction through entropy is truly inevitable.
+topics include the fate of the universe and whether entropy is reversible.
.SH SEE ALSO
<http://multivax.com/last_question.html>
.SH AUTHOR
diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh
index 71e952a0..f9dfa584 100644
--- a/pdksh/pdkshrc.d/prompt.pdksh
+++ b/pdksh/pdkshrc.d/prompt.pdksh
@@ -95,21 +95,35 @@ prompt() {
fi
branch=${branch##*/}
+ # Refresh index so e.g. git-diff-files(1) is accurate
+ git update-index --refresh >/dev/null
+
+ # Collect symbols representing repository state
typeset state
- if ! git diff-files --quiet ; then
- # Two exclamation marks, as that's how you get a literal "!" in
- # a pdksh PS1
- state=${state}!!
- fi
- if ! git diff-index --cached --quiet HEAD ; then
- state=${state}+
- fi
- if [[ -n $(git ls-files --others --exclude-standard) ]] ; then
- state=${state}?
- fi
- if git rev-parse --verify refs/stash >/dev/null 2>&1 ; then
- state=${state}^
- fi
+
+ # Upstream HEAD has commits after local HEAD; we're "behind"
+ (($(git rev-list --count 'HEAD..@{u}' 2>/dev/null) > 0)) &&
+ state=${state}\<
+
+ # Local HEAD has commits after upstream HEAD; we're "ahead"
+ (($(git rev-list --count '@{u}..HEAD' 2>/dev/null) > 0)) &&
+ state=${state}\>
+
+ # Tracked files are modified
+ git diff-files --quiet ||
+ state=${state}'!!'
+
+ # Changes are staged
+ git diff-index --cached --quiet HEAD ||
+ state=${state}\+
+
+ # There are some untracked and unignored files
+ [[ -n $(git ls-files --others --exclude-standard) ]] &&
+ state=${state}\?
+
+ # There are stashed changes
+ git rev-parse --quiet --verify refs/stash >/dev/null &&
+ state=${state}\^
# Print the status in brackets; add a git: prefix only if there
# might be another VCS prompt (because PROMPT_VCS is set)
diff --git a/sh/profile.d/grep.sh b/sh/profile.d/grep.sh
index 892351ca..d1ef3ba1 100644
--- a/sh/profile.d/grep.sh
+++ b/sh/profile.d/grep.sh
@@ -13,8 +13,14 @@
# Iterate through some useful options and create files to show they're
# available
- for opt in binary-files color exclude exclude-dir ; do
- grep -q -- --"$opt" "$gcd"/help || continue
+ set -- binary-files \
+ color \
+ devices \
+ directories \
+ exclude \
+ exclude-dir
+ for opt ; do
+ grep -Eq -- --"$opt" "$gcd"/help || continue
touch -- "$gcd"/"$opt" || exit
done
fi
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index df2101aa..2f360716 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -14,6 +14,14 @@ grep() {
[ -e "$HOME"/.cache/grep/binary-files ] &&
set -- --binary-files=without-match "$@"
+ # Add --devices=skip to gracefully skip devices
+ [ -e "$HOME"/.cache/grep/devices ] &&
+ set -- --devices=skip "$@"
+
+ # Add --directories=skip to gracefully skip directories
+ [ -e "$HOME"/.cache/grep/directories ] &&
+ set -- --directories=skip "$@"
+
# Add --exclude to ignore .gitignore and .gitmodules files
[ -e "$HOME"/.cache/grep/exclude ] &&
set -- \
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index c6513aac..80ae7c12 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -43,7 +43,7 @@ sd() {
fi
# Set the positional parameters to either the requested directory, or
- # all of the current directory's siblings if no request
+ # all siblings of the current directory if no request
spec=$1
set --
if [ -n "$spec" ] ; then
diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh
index b8a31aee..1902e3ba 100644
--- a/sh/shrc.d/vr.sh
+++ b/sh/shrc.d/vr.sh
@@ -24,8 +24,8 @@ vr() {
# Ask Mercurial the top level (great)
hg root 2>/dev/null && exit
- # If we can get SVN info, iterate upwards until we can't; hopefully
- # that's the root (bad)
+ # If we can get SVN info, iterate upwards until we cannot; hopefully
+ # that is the root (bad)
while svn info >/dev/null 2>&1 ; do
root=$PWD
[ "$root" = / ] && break
@@ -36,7 +36,7 @@ vr() {
exit
fi
- # Couldn't find repository root, say so
+ # Could not find repository root, say so
printf >&2 'vr(): Failed to find repository root\n'
exit 1
)"