diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-19 20:35:26 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-05-19 20:35:26 +1200 |
commit | a3ddf9e5799a4727625c0676d6e32c055640b9c5 (patch) | |
tree | 3e22a57ea4ae600cf9ec39b521b4b7cc7c407a46 | |
parent | Merge branch 'master' into port/bsd/freebsd (diff) | |
parent | Just use whichever vi(1) we need as VISUAL (diff) | |
download | dotfiles-a3ddf9e5799a4727625c0676d6e32c055640b9c5.tar.gz dotfiles-a3ddf9e5799a4727625c0676d6e32c055640b9c5.zip |
Merge branch 'master' into port/bsd/freebsd
48 files changed, 279 insertions, 78 deletions
@@ -28,6 +28,8 @@ bin/finc bin/fnl bin/gms bin/grc +bin/grec +bin/gred bin/gscr bin/gwp bin/han @@ -61,10 +63,13 @@ bin/onl bin/osc bin/pa bin/paz +bin/ped bin/pit bin/plmu bin/pp bin/pph +bin/pst +bin/pvi bin/pwg bin/quo bin/rfcf @@ -122,6 +127,7 @@ games/drakon games/kvlt games/rndn games/rot13 +games/squ games/strik games/xyzzy games/zs diff --git a/ISSUES.markdown b/ISSUES.markdown index 4c78a3f3..4116adda 100644 --- a/ISSUES.markdown +++ b/ISSUES.markdown @@ -21,3 +21,6 @@ Known issues * Would be good to complete the Makefile variables for NAME, EMAIL etc with educated guesses (`id -u`@`cat /etc/mailname`) etc rather than hardcoding my own stuff in there +* Completion for custom functions e.g. `sd` should ideally respect + `completion-ignore-case` setting +* Copy-mode configuration for tmux needs to be reinstated. @@ -19,27 +19,28 @@ install-gnupg \ install-gtk \ install-i3 \ + install-ksh \ install-less \ install-login-shell \ install-mutt \ + install-mysql \ install-ncmcpp \ install-newsbeuter \ - install-mysql \ - install-ksh \ install-perlcritic \ install-perltidy \ install-psql \ install-readline \ install-sh \ install-subversion \ + install-terminfo \ install-tmux \ install-urxvt \ install-vim \ - install-vim-gui \ install-vim-config \ + install-vim-gui \ install-vim-gui-config \ - install-vim-plugins \ install-vim-pathogen \ + install-vim-plugins \ install-x \ install-yash \ install-zsh \ @@ -49,6 +50,7 @@ check-games \ check-ksh \ check-login-shell \ + check-man \ check-sh \ check-urxvt \ check-xinit \ @@ -102,6 +104,8 @@ BINS = bin/ap \ bin/fnl \ bin/gms \ bin/grc \ + bin/grec \ + bin/gred \ bin/gscr \ bin/gwp \ bin/han \ @@ -135,10 +139,13 @@ BINS = bin/ap \ bin/osc \ bin/pa \ bin/paz \ + bin/ped \ bin/pit \ bin/plmu \ bin/pp \ bin/pph \ + bin/pst \ + bin/pvi \ bin/pwg \ bin/quo \ bin/rfcf \ @@ -197,6 +204,7 @@ GAMES = games/aaf \ games/kvlt \ games/rndn \ games/rot13 \ + games/squ \ games/strik \ games/xyzzy \ games/zs diff --git a/README.markdown b/README.markdown index 85aca3a2..3afc6900 100644 --- a/README.markdown +++ b/README.markdown @@ -50,7 +50,8 @@ installed. * `install-vim` The `install-login-shell` looks at your `SHELL` environment variable and tries -to figure out which shell to install, falling back on just plain `install-sh`. +to figure out which shell’s configuration files to install, falling back on +`install-sh`. The remaining dotfiles can be installed with the other `install-*` targets. Try `sh bin/mftl.sh Makefile` in the project's root directory to see a list. @@ -60,14 +61,13 @@ Tools Configuration is included for: -* Bourne-style POSIX shells, sharing an `ENV` file and functions: +* Bourne-style POSIX shells, sharing a `.profile`, an `ENV` file, and + some helper functions: * [GNU Bash](https://www.gnu.org/software/bash/) (2.05a or higher) * [Korn shell](http://www.kornshell.com/) (including `pdksh`, `mksh`) * [Yash](https://yash.osdn.jp/index.html.en) * [Z shell](https://www.zsh.org/) * [Abook](http://abook.sourceforge.net/) -- curses address book program - including a `~/.profile` configured to work with most Bourne-compatible - shells * [cURL](https://curl.haxx.se/) -- Command-line tool for transferring data with URL syntax * [Dunst](http://knopwob.org/dunst/) -- A lightweight X11 notification daemon @@ -76,15 +76,15 @@ Configuration is included for: * [Git](https://git-scm.com/) -- Distributed version control system * [GnuPG](https://www.gnupg.org/) -- GNU Privacy Guard, for private communication and file encryption -* [GTK+](http://www.gtk.org/) -- GIMP Toolkit, for graphical user interface +* [GTK+](https://www.gtk.org/) -- GIMP Toolkit, for graphical user interface elements * [i3](https://i3wm.org/) -- Tiling window manager * [less](https://www.gnu.org/software/less/) -- Terminal pager * [Mutt](http://www.mutt.org/) -- Terminal mail user agent -* [`mysql(1)`](http://linux.die.net/man/1/mysql) -- Command-line MySQL client +* [`mysql(1)`](https://linux.die.net/man/1/mysql) -- Command-line MySQL client * [Ncmpcpp](https://rybczak.net/ncmpcpp/) -- ncurses music player client * [Newsbeuter](https://www.newsbeuter.org/) -- Terminal RSS/Atom feed reader -* [`psql(1)`](http://linux.die.net/man/1/psql) -- Command-line PostgreSQL +* [`psql(1)`](https://linux.die.net/man/1/psql) -- Command-line PostgreSQL client * [Perl::Critic](http://perlcritic.com/) -- static source code analysis engine for Perl @@ -301,7 +301,7 @@ neither tilde nor `$HOME` expansion works for this. My mail is kept in individual Maildirs under `~/Mail`, with `inbox` being where most unfiltered mail is sent. I use [Getmail](http://pyropus.ca/software/getmail/), -[maildrop](http://www.courier-mta.org/maildrop/), and +[maildrop](https://www.courier-mta.org/maildrop/), and [MSMTP](http://msmtp.sourceforge.net/); the configurations for these are not included here. I sign whenever I have some indication that the recipient might be using a PGP implementation, and I encrypt whenever I have a public key @@ -327,7 +327,7 @@ Perl extensions. If you're missing functionality, try changing My choice of font is [Ubuntu Mono](http://font.ubuntu.com/), but the file should allow falling back to the more common [Deja Vu Sans -Mono](http://dejavu-fonts.org/wiki/Main_Page). I've found +Mono](https://dejavu-fonts.github.io/). I've found [Terminus](http://terminus-font.sourceforge.net/) works well too, but bitmap fonts are not really my cup of tea. The Lohit Kannada font bit is purely to make ಠ\_ಠ work correctly. ( ͡° ͜ʖ ͡°) seems to work out of the box. @@ -448,6 +448,11 @@ Installed by the `install-bin` target: * Two time duration functions: * `hms(1df)` converts seconds to `hh:mm:ss` or `mm:ss` timestamps. * `sec(1df)` converts `hh:mm:ss` or `mm:ss` timestamps to seconds. +* Three pipe interaction tools: + * `pst(1df)` runs an interactive program on data before passing it along + a pipeline. + * `ped(1df)` runs `pst(1df)` with `$EDITOR` or `ed(1)`. + * `pvi(1df)` runs `pvi(1df)` with `$VISUAL` or `vi(1)`. * `ap(1df)` reads arguments for a given command from the standard input, prompting if appropriate. * `apf(1df)` prepends arguments to a command with ones read from a file, @@ -488,6 +493,8 @@ Installed by the `install-bin` target: * `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)`. +* `grec(1df)` is a more logically-named `grep -c`. +* `gred(1df)` is a more logically-named `grep -v`. * `gwp(1df)` searches for alphanumeric words in a similar way to `grep(1)`. * `han(1df)` provides a `keywordprg` for Vim's Bash script filetype that will look for `help` topics. You could use it from the shell too. @@ -553,6 +560,7 @@ There's some silly stuff in `install-games`: * `acq(6df)` allows you to interrogate AC, the interplanetary computer. * `aesth(6df)` converts English letters to their fullwidth CJK analogues, for AESTHETIC PURPOSES. +* `squ(6df)` makes a reduced Latin square out of each line of input. * `kvlt(6df)` translates input to emulate a style of typing unique to black metal communities on the internet. * `rndn(6df)` implements an esoteric random number generation algorithm. @@ -592,15 +600,6 @@ Known issues See ISSUES.markdown. -Note for previous visitors --------------------------- - -Most of this repository's five-year history was rewritten shortly after I moved -it from GitHub to cgit, taking advantage of the upheaval to reduce its size and -remove useless binary blobs and third-party stuff that I never should have -versioned anyway. If you've checked this out before, you'll probably need to do -it again, and per-commit links are likely to be broken. Sorry about that. - License ------- @@ -610,6 +609,6 @@ If you're feeling generous, please join and/or donate to a free software advocacy group, and let me know you did it because of this project: * [Free Software Foundation](https://www.fsf.org/) -* [Software in the Public Interest](http://www.spi-inc.org/) +* [Software in the Public Interest](https://www.spi-inc.org/) * [FreeBSD Foundation](https://www.freebsdfoundation.org/) * [OpenBSD Foundation](http://www.openbsdfoundation.org/) @@ -28,6 +28,9 @@ super + m super + p dmp +super + v + urxvtcd -e "$VISUAL" + super + slash i3lock --color=#000000 --image ~/.i3/lock.png --nofork @@ -1,3 +1,3 @@ # Fire up bc(1), hushing it if it looks like GNU -[ -e "$HOME"/.cache/bc/quiet ] && set -- --quiet "$@" +[ -e "$HOME"/.cache/sh/opt/bc/quiet ] && set -- --quiet "$@" exec bc "$@" diff --git a/bin/clog.sh b/bin/clog.sh index 0964ce90..b17ff1c5 100644 --- a/bin/clog.sh +++ b/bin/clog.sh @@ -1,7 +1,16 @@ +#!/bin/sh # Record a timestamped message to a logfile, defaulting to ~/.clog self=clog + +# Ignore arguments +set -- + +# If we have rlwrap, quietly use it command -v rlwrap >/dev/null 2>&1 && set -- rlwrap -C "$self" "$@" + +# Write the date, the standard input (rlwrapped if applicable), and two dashes +# to $CLOG, defaulting to ~/.clog. { date "$@" cat - diff --git a/bin/csmw.awk b/bin/csmw.awk index b1cd20cb..4479d8f8 100644 --- a/bin/csmw.awk +++ b/bin/csmw.awk @@ -1,14 +1,14 @@ # Print an English comma-separated list of monospace-quoted words (backticks) { for (i = 1; i <= NF; i++) - ws[++wc] = $i + ws[++wc] = "`" $i "`" } END { if (wc > 2) for (i = 1; i <= wc; i++) - printf (i < wc) ? "`%s`, " : "and `%s`\n", ws[i] + printf (i < wc) ? "%s, " : "and %s\n", ws[i] else if (wc == 2) - printf "`%s` and `%s`\n", ws[1], ws[2] + printf "%s and %s\n", ws[1], ws[2] else if (wc == 1) - printf "`%s`\n", ws[1] + printf "%s\n", ws[1] } @@ -1,3 +1,4 @@ +# Pick a pass(1) password with dmenu(1) # Get the password store directory, bail if we can't pwsd=${PASSWORD_STORE_DIR:-"$HOME"/.password-store} @@ -1,12 +1,9 @@ # Prevent Vim's ex(1) implementation from clearing the screen if [ -t 0 ] ; then - ver=$(ex --version 2>/dev/null | awk 'NR==1{print $1;exit}') - case $ver in - # Lie to Vim; tell it it's a dumb terminal, and that its required "cm" - # feature is invoked with a carriage return. - VIM) - cmd=$(printf 'set t_cm=\r|') - set -- -T dumb --cmd "${cmd%|}" "$@" ;; - esac + + # Lie to Vim; tell it it's a dumb terminal, and that its required "cm" + # feature is invoked with a carriage return. + cmd=$(printf 'set t_cm=\r|') + set -- -T dumb --cmd "${cmd%|}" "$@" fi exec ex "$@" diff --git a/bin/grec.sh b/bin/grec.sh new file mode 100644 index 00000000..035b7cce --- /dev/null +++ b/bin/grec.sh @@ -0,0 +1,2 @@ +# g/re/c +grep -c "$@" diff --git a/bin/gred.sh b/bin/gred.sh new file mode 100644 index 00000000..46de5dce --- /dev/null +++ b/bin/gred.sh @@ -0,0 +1,2 @@ +# g/re/d +grep -v "$@" diff --git a/bin/hms.awk b/bin/hms.awk index 3a9a1499..3054db44 100644 --- a/bin/hms.awk +++ b/bin/hms.awk @@ -1,3 +1,4 @@ +# Convert seconds to colon-delimited durations BEGIN { OFS = ":" } diff --git a/bin/jfcd.sh b/bin/jfcd.sh index bf059883..25bf03fd 100644 --- a/bin/jfcd.sh +++ b/bin/jfcd.sh @@ -1,4 +1,3 @@ - # Watch a directory for changes and commit them with jfc(1d) if there are any; # requires inotifywait(1) self=jfcd diff --git a/bin/ped.sh b/bin/ped.sh new file mode 100644 index 00000000..ba2f7e66 --- /dev/null +++ b/bin/ped.sh @@ -0,0 +1,2 @@ +# Use pst(1df) to edit a pipe partway through, like vipe(1) +pst "${EDITOR:-ed}" @@ -1,3 +1,4 @@ +# Show arguments or output in a pager if stdout looks like a terminal # If no arguments, we'll use stdin if [ "$#" -eq 0 ] ; then diff --git a/bin/plmu.sh b/bin/plmu.sh index d6f163e6..b6a500ac 100644 --- a/bin/plmu.sh +++ b/bin/plmu.sh @@ -1,3 +1,4 @@ +# Upgrade plenv modules with cpanm(1) # Set up exceptions file if it exists ef=$HOME/.plenv/non-cpanm-modules diff --git a/bin/pst.sh b/bin/pst.sh new file mode 100644 index 00000000..fdea9884 --- /dev/null +++ b/bin/pst.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Interrupt a pipe with manual /dev/tty input to a program +self=pst + +# Don't accept terminal as stdin +if [ -t 0 ] ; then + printf >&2 '%s: stdin is a term\n' "$self" + exit 2 +fi + +# Create a temporary directory with name in $td, and handle POSIX-ish traps to +# remove it when the script exits. +td= +cleanup() { + [ -n "$td" ] && rm -fr -- "$td" + if [ "$1" != EXIT ] ; then + trap - "$1" + kill "-$1" "$$" + fi +} +for sig in EXIT HUP INT TERM ; do + # shellcheck disable=SC2064 + trap "cleanup $sig" "$sig" +done +td=$(mktd "$self") || exit + +# Run the interactive command on the temporary file forcing /dev/tty as +# input/output +tf=$td/data +cat - > "$tf" || exit +"${@:-"${PAGER:-more}"}" "$tf" </dev/tty >/dev/tty +cat -- "$tf" || exit diff --git a/bin/pvi.sh b/bin/pvi.sh new file mode 100644 index 00000000..85fc5671 --- /dev/null +++ b/bin/pvi.sh @@ -0,0 +1,2 @@ +# Use pst(1df) to edit a pipe partway through, like vipe(1) +pst "${VISUAL:-vi}" diff --git a/bin/quo.sed b/bin/quo.sed index 26250e9e..87bdbfda 100644 --- a/bin/quo.sed +++ b/bin/quo.sed @@ -1,2 +1,3 @@ +# Quote or re-quote input in an email style /^[^>]/s/^/ / s/^/>/ diff --git a/bin/rfcf.sh b/bin/rfcf.sh index 36b1a4c4..214f4e64 100644 --- a/bin/rfcf.sh +++ b/bin/rfcf.sh @@ -1,3 +1,4 @@ +# Fetch an RFC from the IETF site and write it to stdout # Check arguments if [ "$#" -ne 1 ] ; then diff --git a/bin/rfcr.sh b/bin/rfcr.sh index 860ae53d..30954154 100644 --- a/bin/rfcr.sh +++ b/bin/rfcr.sh @@ -1,3 +1,4 @@ +# Fetch and format an RFC from the IETF website and view it on a terminal # Check arguments if [ "$#" -ne 1 ] ; then diff --git a/games/acq.sed b/games/acq.sed index 650fdedb..b6051c14 100644 --- a/games/acq.sed +++ b/games/acq.sed @@ -1,2 +1,3 @@ # Interrogate the interplanetary computer. -s/.*/THERE IS INSUFFICIENT DATA FOR MEANINGFUL ANSWER./ +c\ +THERE IS INSUFFICIENT DATA FOR A MEANINGFUL ANSWER. diff --git a/games/dr.sh b/games/dr.sh index e1db163d..9f08164d 100644 --- a/games/dr.sh +++ b/games/dr.sh @@ -16,7 +16,7 @@ d=${nd#*d} # Check this is a real die you can actually roll case $d in - 4|6|8|10|12|20) : ;; + 4|6|8|10|12|20) ;; *) exit 2 ;; esac diff --git a/games/drakon.awk b/games/drakon.awk index 4b8c35c5..b8d72888 100644 --- a/games/drakon.awk +++ b/games/drakon.awk @@ -1,11 +1,12 @@ # TyPe lIkE AnDoR DrAkOn fRoM AnCiEnT DoMaInS Of mYsTeRy # <http://www.adomgb.info/adomgb-4.html> { + len = length line = "" toggle = 0 - for (i = 1; i <= length; i++) { + for (i = 1; i <= len; i++) { char = substr($0, i, 1) - if (char ~ /[a-zA-Z]/) + if (char ~ /[[:alpha:]]/) char = (toggle = !toggle) ? tolower(char) : toupper(char) line = line char } diff --git a/games/squ.awk b/games/squ.awk new file mode 100644 index 00000000..abd16934 --- /dev/null +++ b/games/squ.awk @@ -0,0 +1,7 @@ +# Make a reduced Latin square out of each line of input +l = length { + str = toupper($0) + for (j = 0; j < l; j++) + for (k = 0; k < l; k++) + printf (k < l - 1) ? "%s " : "%s\n", substr(str, (k + j) % l + 1, 1) +} diff --git a/irssi/aliases b/irssi/aliases index b22da923..65e80c13 100644 --- a/irssi/aliases +++ b/irssi/aliases @@ -10,5 +10,6 @@ alias aesth exec - -out printf %s "$*" | aesth alias drakon exec - -out printf %s "$*" | drakon alias kvlt exec - -out printf %s "$*" | kvlt alias rot13 exec - -out printf %s "$*" | rot13 +alias squ exec - -out printf %s "$*" | squ alias strik exec - -out printf %s "$*" | strik alias zs exec - -out printf %s "$*" | zs diff --git a/man/man1/grec.1df b/man/man1/grec.1df new file mode 100644 index 00000000..8759aa33 --- /dev/null +++ b/man/man1/grec.1df @@ -0,0 +1,13 @@ +.TH GREC 1df "April 2017" "Manual page for grec" +.SH NAME +.B grec +\- saner name for grep -c +.SH SYNOPSIS +.B grec PATTERN [FILE...] +.br +.SH DESCRIPTION +.B grec +is the same as grep(1) when run with a a -c option, because the name always +bugged me a bit--"g/re/p, except don't print it, count it"? +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/gred.1df b/man/man1/gred.1df new file mode 100644 index 00000000..8fcc4d74 --- /dev/null +++ b/man/man1/gred.1df @@ -0,0 +1,13 @@ +.TH GRED 1df "April 2017" "Manual page for gred" +.SH NAME +.B gred +\- saner name for grep -v +.SH SYNOPSIS +.B gred PATTERN [FILE...] +.br +.SH DESCRIPTION +.B gred +is the same as grep(1) when run with a a -v option, because the name always +bugged me a bit--"g/re/p, except don't print it, delete it"? +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/mex.1df b/man/man1/mex.1df index 0fa584da..5c387594 100644 --- a/man/man1/mex.1df +++ b/man/man1/mex.1df @@ -10,12 +10,13 @@ name name1 name2 name3 .br PATH=/foo:/bar/baz +.B mex name .SH DESCRIPTION -Iterate through the contents of the PATH variable looking for files with any of +Iterate through the directories named in $PATH looking for files with any of the specified names that do not have the executable permissions bit set, and -try to set it if found. Exit nonzero if any of the names were not found, or if -any of the permissions changes failed. +attempt to set them if any such files are found. Exit nonzero if any of the +names were not found, or if any of the permissions changes failed. .SH SEE ALSO chmod(1), eds(1df) .SH AUTHOR diff --git a/man/man1/ped.1df b/man/man1/ped.1df new file mode 100644 index 00000000..fba85943 --- /dev/null +++ b/man/man1/ped.1df @@ -0,0 +1,19 @@ +.TH PED 1df "May 2017" "Manual page for ped" +.SH NAME +.B ped +\- stop a pipe for $EDITOR intervention +.SH SYNOPSIS +prog1 | +.B +ped +| prog2 +.SH DESCRIPTION +.B ped +saves all its standard input into a temporary file and runs $EDITOR, or ed(1) +if unset, on that file. Once the editor exits, it emits the contents of the +same file (changed or unchanged). This can be used as a way to edit data +manually as it goes through a pipe. +.SH SEE ALSO +pst(1df), pvi(1df) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/pst.1df b/man/man1/pst.1df new file mode 100644 index 00000000..cf3ce281 --- /dev/null +++ b/man/man1/pst.1df @@ -0,0 +1,25 @@ +.TH PST 1df "May 2017" "Manual page for pst" +.SH NAME +.B pst +\- stop a pipe for manual viewing or intervention +.SH SYNOPSIS +prog1 | +.B +pst +| prog2 +.br +prog1 | +.B +pst ed +| prog2 +.SH DESCRIPTION +.B pst +saves all its standard input into a temporary file and runs the interactive +command given, defaulting to a suitable pager, and then emits the contents of +the same file (changed or unchanged) after the program exits. This can be used +as a way to watch the progress of data as it goes through the pipe, or to +manually edit it. +.SH SEE ALSO +ped(1df), pvi(1df) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/pvi.1df b/man/man1/pvi.1df new file mode 100644 index 00000000..990ea589 --- /dev/null +++ b/man/man1/pvi.1df @@ -0,0 +1,19 @@ +.TH PED 1df "May 2017" "Manual page for pvi" +.SH NAME +.B pvi +\- stop a pipe for $EDITOR intervention +.SH SYNOPSIS +prog1 | +.B +pvi +| prog2 +.SH DESCRIPTION +.B pvi +saves all its standard input into a temporary file and runs $VISUAL, or vi(1) +if unset, on that file. Once the editor exits, it emits the contents of the +same file (changed or unchanged). This can be used as a way to edit data +manually as it goes through a pipe. +.SH SEE ALSO +pst(1df), ped(1df) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/quo.1df b/man/man1/quo.1df index 0b651388..56cf685a 100644 --- a/man/man1/quo.1df +++ b/man/man1/quo.1df @@ -16,9 +16,9 @@ FILE1 [FILE2...] < FILE .SH DESCRIPTION .B quo -quotes its input by insert a right-angle bracket followed by a space at the +quotes its input by inserting a right-angle bracket followed by a space at the start of every unquoted line. If the line was already quoted, it adds another -level of right-angle bracket. +level of right-angle brackets. .SH SEE ALSO wro(1df) .SH AUTHOR diff --git a/man/man6/squ.6df b/man/man6/squ.6df new file mode 100644 index 00000000..f836f2cd --- /dev/null +++ b/man/man6/squ.6df @@ -0,0 +1,30 @@ +.TH SQU 6df "May 2017" "Manual page for squ" +.SH NAME +.B squ +\- print a reduced Latin square made out of each line of input +.SH USAGE +.B squ +.br +london +.br +^D +.br +L O N D O N +.br +O N D O N L +.br +N D O N L O +.br +D O N L O N +.br +O N L O N D +.br +N L O N D O +.SH DESCRIPTION +.B squ +makes a reduced Latin square [1] out of the characters on each line of input, +uppercasing them first. +.SH SEE ALSO +[1]: https://en.wikipedia.org/wiki/Latin_square#Reduced_form +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> diff --git a/sh/profile.d/editor.sh b/sh/profile.d/editor.sh index 307879fe..debb93b6 100644 --- a/sh/profile.d/editor.sh +++ b/sh/profile.d/editor.sh @@ -3,12 +3,21 @@ if command -v ed >/dev/null 2>&1 ; then EDITOR=ed -# Failing that, if we have both vim(1) and exm(1df) in our $PATH, use the -# latter to work around Vim's ex mode screen-clearing -elif { command -v vim && command -v exm ; } >/dev/null 2>&1 ; then +# Failing that, if the system's implementation of ex(1) looks like Vim and we +# have exm(1df) in our $PATH, use the latter to work around Vim's ex mode +# screen-clearing +elif ( + command -v ex >/dev/null 2>&1 || exit 1 + command -v exm >/dev/null 2>&1 || exit 1 + ver=$(ex --version 2>/dev/null | awk 'NR==1{print $1;exit}') + case $ver in + (VIM) exit 0 ;; + (*) exit 1 ;; + esac +) >/dev/null 2>&1 ; then EDITOR=exm -# Otherwise, just call ex(1) directly +# Otherwise, we can just call ex(1) directly else EDITOR=ex fi diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh index 1a511d75..89b5d245 100644 --- a/sh/profile.d/options.sh +++ b/sh/profile.d/options.sh @@ -5,7 +5,7 @@ options() { # Check or create the directory to cache the options # Shift the program name off; remaining arguments are the options to check - dir=$HOME/.cache/$1 + dir=$HOME/.cache/sh/opt/$1 prog=$1 shift diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh index d03da255..38ab9893 100644 --- a/sh/profile.d/visual.sh +++ b/sh/profile.d/visual.sh @@ -1,7 +1,3 @@ -# Set visual editor; vim if we've got it, but vi will do fine -if command -v vim >/dev/null 2>&1 ; then - VISUAL=vim -else - VISUAL=vi -fi +# Use first found implementation of vi(1) +VISUAL=vi export VISUAL diff --git a/sh/shrc.d/bc.sh b/sh/shrc.d/bc.sh index 41331ff9..aee88e09 100644 --- a/sh/shrc.d/bc.sh +++ b/sh/shrc.d/bc.sh @@ -1,12 +1,12 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping bc(1) with a function at all -[ -d "$HOME"/.cache/bc ] || return +[ -d "$HOME"/.cache/sh/opt/bc ] || return # Define function proper bc() { # Add --quiet to stop the annoying welcome banner - [ -e "$HOME"/.cache/bc/quiet ] && + [ -e "$HOME"/.cache/sh/opt/bc/quiet ] && set -- --quiet "$@" # Run bc(1) with the concluded arguments diff --git a/sh/shrc.d/ed.sh b/sh/shrc.d/ed.sh index d7d3fa2f..a2b7818e 100644 --- a/sh/shrc.d/ed.sh +++ b/sh/shrc.d/ed.sh @@ -8,7 +8,7 @@ ed() { fi # Add --verbose to explain errors - [ -e "$HOME"/.cache/ed/verbose ] && + [ -e "$HOME"/.cache/sh/opt/ed/verbose ] && set -- --verbose "$@" # Add an asterisk prompt (POSIX feature) diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh index fc8f62c0..dd85a198 100644 --- a/sh/shrc.d/grep.sh +++ b/sh/shrc.d/grep.sh @@ -1,6 +1,6 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping grep(1) with a function at all -[ -d "$HOME"/.cache/grep ] || return +[ -d "$HOME"/.cache/sh/opt/grep ] || return # Discard GNU grep(1) environment variables if the environment set them unset -v GREP_OPTIONS @@ -9,31 +9,31 @@ unset -v GREP_OPTIONS grep() { # Add --binary-files=without-match to gracefully skip binary files - [ -e "$HOME"/.cache/grep/binary-files ] && + [ -e "$HOME"/.cache/sh/opt/grep/binary-files ] && set -- --binary-files=without-match "$@" # Add --color=auto if the terminal has at least 8 colors - [ -e "$HOME"/.cache/grep/color ] && + [ -e "$HOME"/.cache/sh/opt/grep/color ] && [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" # Add --devices=skip to gracefully skip devices - [ -e "$HOME"/.cache/grep/devices ] && + [ -e "$HOME"/.cache/sh/opt/grep/devices ] && set -- --devices=skip "$@" # Add --directories=skip to gracefully skip directories - [ -e "$HOME"/.cache/grep/directories ] && + [ -e "$HOME"/.cache/sh/opt/grep/directories ] && set -- --directories=skip "$@" # Add --exclude to ignore .gitignore and .gitmodules files - [ -e "$HOME"/.cache/grep/exclude ] && + [ -e "$HOME"/.cache/sh/opt/grep/exclude ] && set -- \ --exclude=.gitignore \ --exclude=.gitmodules \ "$@" # Add --exclude-dir to ignore version control dot-directories - [ -e "$HOME"/.cache/grep/exclude-dir ] && + [ -e "$HOME"/.cache/sh/opt/grep/exclude-dir ] && set -- \ --exclude-dir=.cvs \ --exclude-dir=.git \ diff --git a/sh/shrc.d/la.sh b/sh/shrc.d/la.sh index e21ad8fb..1ac44b8e 100644 --- a/sh/shrc.d/la.sh +++ b/sh/shrc.d/la.sh @@ -1,7 +1,7 @@ # Run ls -A if we can (-A is not POSIX), ls -a otherwise la() { # Prefer --almost-all (exclude "." and "..") if available - if [ -e "$HOME"/.cache/ls/almost-all ] ; then + if [ -e "$HOME"/.cache/sh/opt/ls/almost-all ] ; then set -- -A "$@" else set -- -a "$@" diff --git a/sh/shrc.d/ll.sh b/sh/shrc.d/ll.sh index c8c95d3b..e9737c62 100644 --- a/sh/shrc.d/ll.sh +++ b/sh/shrc.d/ll.sh @@ -1,7 +1,7 @@ # Run ls -Al if we can (-A is not POSIX), ls -al otherwise ll() { # Prefer -A/--almost-all (exclude "." and "..") if available - if [ -e "$HOME"/.cache/ls/almost-all ] ; then + if [ -e "$HOME"/.cache/sh/opt/ls/almost-all ] ; then set -- -Al "$@" else set -- -al "$@" diff --git a/sh/shrc.d/ls.sh b/sh/shrc.d/ls.sh index 05e7a06c..40a0a5ce 100644 --- a/sh/shrc.d/ls.sh +++ b/sh/shrc.d/ls.sh @@ -1,6 +1,6 @@ # Our ~/.profile should already have made a directory with the supported # options for us; if not, we won't be wrapping ls(1) with a function at all -[ -d "$HOME"/.cache/ls ] || return +[ -d "$HOME"/.cache/sh/opt/ls ] || return # If the system has already aliased ls(1) for us, like Slackware or OpenBSD # does, just get rid of it @@ -20,17 +20,17 @@ ls() { [ -t 1 ] && set -- -x "$@" # Add --block-size=K to always show the filesize in kibibytes - [ -e "$HOME"/.cache/ls/block-size ] && + [ -e "$HOME"/.cache/sh/opt/ls/block-size ] && set -- --block-size=1024 "$@" # Add --color if the terminal has at least 8 colors - [ -e "$HOME"/.cache/ls/color ] && + [ -e "$HOME"/.cache/sh/opt/ls/color ] && [ "$({ tput colors || tput Co ; } 2>/dev/null)" -ge 8 ] && set -- --color=auto "$@" # Add --time-style='+%Y-%m-%d %H:%M:%S' to show the date in my preferred # (fixed) format - [ -e "$HOME"/.cache/ls/time-style ] && + [ -e "$HOME"/.cache/sh/opt/ls/time-style ] && set -- --time-style='+%Y-%m-%d %H:%M:%S' "$@" # If the operating system is FreeBSD, there are some specific options we diff --git a/tmux/tmux.conf.m4 b/tmux/tmux.conf.m4 index facb91ca..ffac0243 100644 --- a/tmux/tmux.conf.m4 +++ b/tmux/tmux.conf.m4 @@ -57,11 +57,6 @@ bind-key j select-pane -D bind-key k select-pane -U bind-key l select-pane -R -# Vim-like keys for visual mode and yanking therefrom -bind-key -t vi-copy 'v' begin-selection -bind-key -t vi-copy 'y' copy-selection -bind-key -t vi-copy Escape cancel - # Join and break panes bind-key J choose-window "join-pane -h -s '%%'" bind-key B break-pane -d diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen -Subproject 020ab25c38f62627c1dab6c7a851176c6ad309f +Subproject 0f4710063ecc98d77dc03698c4a917a3215bdf0 diff --git a/vim/bundle/repeat b/vim/bundle/repeat -Subproject 7a6675f092842c8f81e71d5345bd7cdbf375941 +Subproject 070ee903245999b2b79f7386631ffd29ce9b8e9 diff --git a/vim/bundle/unimpaired b/vim/bundle/unimpaired -Subproject e939771979393c502e2331fc7d44a963efd7bb4 +Subproject 0f72c70b672aeadaaab94e430267b1435c1b244 |