aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2020-05-05 19:24:42 +1200
committerTom Ryder <tom@sanctum.geek.nz>2020-05-05 19:24:42 +1200
commit54ad424b8ce977e6f818dfb283ad0777e7ec8094 (patch)
treedd5dc73db0317f3932e9929be58beefa649cbb6e
parentMerge branch 'hotfix/v8.28.2' (diff)
parentUpdate dotfiles(7) manual page (diff)
downloaddotfiles-8.29.0.tar.gz (sig)
dotfiles-8.29.0.zip
Merge branch 'release/v8.29.0'v8.29.0
* release/v8.29.0: Update dotfiles(7) manual page Switch undoskip.vim to use globs Attempt to imitate 'backupskip' pats in undoskip Revert "Add /tmp to 'backupskip'" Add /tmp to 'backupskip' Add /usr/tmp to the list of undoskip paths Break undoskip patterns into linewise list Use msc(1df) output in tmux status Add msc(1df) Add Bcc and terminating columns to Mutt pager hdrs Correct and refine explanation of 'thesaurus' Working on rewording vimrc
-rw-r--r--.gitignore1
-rw-r--r--Makefile1
-rw-r--r--README.md1
-rw-r--r--VERSION4
-rwxr-xr-xbin/msc.sh12
-rw-r--r--man/man1/msc.1df12
-rw-r--r--man/man7/dotfiles.7df2
-rw-r--r--mutt/muttrc4
-rw-r--r--tmux/tmux.conf2
-rw-r--r--vim/plugin/undoskip.vim25
-rw-r--r--vim/vimrc122
11 files changed, 116 insertions, 70 deletions
diff --git a/.gitignore b/.gitignore
index 9b244d4d..b2601fbc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,6 +73,7 @@
/bin/mkvi
/bin/mode
/bin/motd
+/bin/msc
/bin/murl
/bin/mw
/bin/nlbr
diff --git a/Makefile b/Makefile
index 098907c8..498af984 100644
--- a/Makefile
+++ b/Makefile
@@ -160,6 +160,7 @@ BINS = bin/ap \
bin/mkvi \
bin/mode \
bin/motd \
+ bin/msc \
bin/murl \
bin/mw \
bin/nlbr \
diff --git a/README.md b/README.md
index b75c368f..6346c455 100644
--- a/README.md
+++ b/README.md
@@ -551,6 +551,7 @@ These scripts are installed by the `install-bin` target:
* `mkcp(1df)` creates a directory and copies preceding arguments into it.
* `mkmv(1df)` creates a directory and moves preceding arguments into it.
* `motd(1df)` shows the system MOTD.
+* `msc(1df)` crudely counts messages in an mbox.
* `mw(1df)` prints alphabetic space-delimited words from the input one per
line.
* `oii(1df)` runs a command on input only if there is any.
diff --git a/VERSION b/VERSION
index d3b7b1d9..432d8a02 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v8.28.2
-Sun, 03 May 2020 11:59:39 +0000
+tejr dotfiles v8.29.0
+Tue, 05 May 2020 07:24:39 +0000
diff --git a/bin/msc.sh b/bin/msc.sh
new file mode 100755
index 00000000..feb39b14
--- /dev/null
+++ b/bin/msc.sh
@@ -0,0 +1,12 @@
+# Crudely but quickly count mail in the user's inbox, if we can find it
+username=$(id -nu)
+if [ "$#" -eq 0 ] ; then
+ set -- "$MAIL" /var/mail/"$username" /var/spool/mail/"$username"
+fi
+for path ; do
+ [ -e "$path" ] || continue
+ grep -ch -- '^From ' "$path"
+ exit
+done
+printf >&2 'Couldn'\''t find user mail spool; provide it as an argument...?\n'
+exit 1
diff --git a/man/man1/msc.1df b/man/man1/msc.1df
new file mode 100644
index 00000000..b8aadb11
--- /dev/null
+++ b/man/man1/msc.1df
@@ -0,0 +1,12 @@
+.TH MSC 1df "May 2020" "Manual page for msc"
+.SH NAME
+.B msc
+\- count the messages in a user's mail spool or other mbox
+.SH SYNOPSIS
+.B msc
+.SH DESCRIPTION
+.B msc
+counts the messages in the given mailboxes, or the user mail spool if not
+provided and it can be found in the MAIL env var or at common paths.
+.SH AUTHOR
+Tom Ryder <tom@sanctum.geek.nz>
diff --git a/man/man7/dotfiles.7df b/man/man7/dotfiles.7df
index 9f76496d..29ae08b7 100644
--- a/man/man7/dotfiles.7df
+++ b/man/man7/dotfiles.7df
@@ -859,6 +859,8 @@ into it.
.IP \[bu] 2
\f[C]motd(1df)\f[] shows the system MOTD.
.IP \[bu] 2
+\f[C]msc(1df)\f[] crudely counts messages in an mbox.
+.IP \[bu] 2
\f[C]mw(1df)\f[] prints alphabetic space\-delimited words from the input
one per line.
.IP \[bu] 2
diff --git a/mutt/muttrc b/mutt/muttrc
index 47c2b6ac..f3bdbfc6 100644
--- a/mutt/muttrc
+++ b/mutt/muttrc
@@ -43,8 +43,8 @@ set mark_old = no
# Headers
ignore *
-unignore Date From: To Cc Subject
-hdr_order Date From: To Cc Subject
+unignore Date: From: To: Cc: Bcc: Subject:
+hdr_order Date: From: To: Cc: Bcc: Subject:
set edit_headers = yes
# Index
diff --git a/tmux/tmux.conf b/tmux/tmux.conf
index 2eb1665a..96d052a3 100644
--- a/tmux/tmux.conf
+++ b/tmux/tmux.conf
@@ -69,7 +69,7 @@ bind-key s choose-session
set-option -g status-left '[#S] '
# Username, hostname, and the current date on the right side of the status bar
-set-option -g status-right ' [#H] %F %T'
+set-option -g status-right ' (mail:#(msc)) [#H] %F %T'
# Update the status bar every second
set-option -g status-interval 1
diff --git a/vim/plugin/undoskip.vim b/vim/plugin/undoskip.vim
index ffbabf86..af66f480 100644
--- a/vim/plugin/undoskip.vim
+++ b/vim/plugin/undoskip.vim
@@ -4,13 +4,28 @@
" Author: Tom Ryder <tom@sanctum.geek.nz>
" License: Same as Vim itself
"
-if exists('loaded_undoskip') || &compatible || !has('persistent_undo')
+if exists('loaded_undoskip') || &compatible
+ finish
+endif
+if !has('persistent_undo') || !exists('*glob2regpat')
finish
endif
let loaded_undoskip = 1
-" Set the paths to test; can be changed by the user
-let g:undoskip_patterns = ['^/dev/shm/.', '^/tmp/.', '^/var/tmp/.']
+" Set default list of patterns to exclude; mirror documented 'backupskip'
+" behavior
+if !exists('g:undoskip')
+ let g:undoskip = []
+ if has('mac')
+ call add(g:undoskip, '/private/tmp/*')
+ elseif has('unix')
+ call add(g:undoskip, '/tmp/*')
+ endif
+ call extend(g:undoskip, map(
+ \ filter([$TMPDIR, $TMP, $TEMP], 'v:val !=# '''''),
+ \ 'v:val.''/*'''
+ \))
+endif
" Internal function returns a local value for 'undofile'
function s:CheckUndoSkip() abort
@@ -23,8 +38,8 @@ function s:CheckUndoSkip() abort
" Get the path from the buffer name; if that path matches any of the
" patterns, don't save undo data
let path = bufname('%')
- for pattern in g:undoskip_patterns
- if path =~# pattern
+ for glob in g:undoskip
+ if path =~# glob2regpat(glob)
return 0
endif
endfor
diff --git a/vim/vimrc b/vim/vimrc
index 40e744c1..d60d66fd 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -2,7 +2,7 @@
" Tom Ryder (tejr)’s Literate Vimrc
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
"
-" Last updated: Sun, 03 May 2020 03:46:29 UTC
+" Last updated: Mon, 04 May 2020 00:51:58 UTC
"
" │ And I was lifted up in heart, and thought
" │ Of all my late-shown prowess in the lists,
@@ -18,89 +18,94 @@
" tradition of Donald Knuth’s “literate programming”:
" <http://www.literateprogramming.com/>
"
-" The dotfiles project that comprises it is maintained here:
+" The dotfiles project as part of which it is maintained is here:
" <https://sanctum.geek.nz/cgit/dotfiles.git>
"
-" This is a long file, and comments abound within. Should this be bothersome,
-" one could execute this command in Vim itself to strip out all lines either
-" blank or comprising solely comments:
+" This is a long file, and comments abound. Should this be bothersome, one
+" could execute this command in Vim itself, to strip out comment blocks and
+" blank lines:
"
" :g/\m^$\|^\s*"/d
"
-" This file should be saved as ‘vimrc’—no leading period—in the user runtime
-" directory. On Unix-like operating systems, hereinafter referred to as
-" “*nix”, that directory is ‘~/.vim’; on Windows, it’s ‘~/vimfiles’.
-" Fortunately, those are the only two kinds of operating systems that exist,
-" anywhere in the world.
+" This file requires Vim v7.0.0 or newer—including the +eval feature—and with
+" the 'compatible' option turned off, chiefly to allow line continuations in
+" Vim script. The vimrc stub at ~/.vimrc (Unix) or ~/_vimrc (Windows) should
+" check that these conditions are met before loading this file with ‘:runtime
+" vimrc’. It should be saved as ‘vimrc’—note no leading period—in the user
+" runtime directory. On GNU/Linux, Mac OS X, and BSD, that directory is
+" ‘~/.vim’. On Windows, it’s ‘~/vimfiles’.
"
-" It requires Vim v7.0.0 or newer, with the +eval feature, and the
-" 'compatible' option turned off, chiefly to allow line continuations. The
-" vimrc stub at ~/.vimrc (Unix) or ~/_vimrc (Windows) should check that these
-" conditions are met before loading this file with ‘:runtime vimrc’.
-"
-" All of this should survive a pass of the Vim script linter Vint with no
+" The whole file should survive a pass of the Vim script linter Vint with no
" errors, warnings, or style problems: <https://github.com/Kuniwak/vint>
"
-
" We’ll begin by making sure that we and Vim are speaking the same language.
-" Since it’s been the future for a few years now, this file has characters
-" outside the ASCII character set, which prompts Vint to suggest declaring the
-" file encoding with a :scriptencoding command. The :help for that command
-" specifies that this should be done after 'encoding' is set, so we’ll do that
-" here, too.
-"
-" On *nix, I define the primary locale environment variable $LANG, almost
-" always specifying a multi-byte locale. This informs Vim’s choice of
-" internal character encoding, but the default for the 'encoding' option in
-" the absence of a valid $LANG is ‘latin1’. Since this is almost never what
-" I want, we’ll manually choose the UTF-8 encoding for Unicode in the absence
-" of any other explicit specification.
-"
-if &encoding ==# 'latin1' && !exists('$LANG')
- set encoding=utf-8
+" Since it’s been the future for a few years now, this file indulges in
+" characters outside the ASCII character set. This prompts Vint to suggest
+" declaring the file encoding with a :scriptencoding command. The :help for
+" :scriptencoding specifies that this should be done after 'encoding' is set,
+" so we’ll do that here first.
+"
+" On POSIX-fearing operating systems, I define the primary locale environment
+" variable $LANG, almost always specifying a multi-byte locale. This informs
+" Vim’s choice of internal character encoding. The default for the 'encoding'
+" option in the absence of a valid $LANG setting is ‘latin1’. Since this is
+" almost never what I want, we’ll explicitly fall back to the UTF-8 encoding
+" for Unicode, in the absence of any other explicit specification. We need to
+" test that the +multi_byte feature is available before doing this, however,
+" since it was a non-default compile-time option in Vim v7.0.
+"
+if has#('multi_byte')
+ if &encoding ==# 'latin1' && !exists('$LANG')
+ set encoding=utf-8
+ endif
+ scriptencoding utf-8
endif
-scriptencoding utf-8
" With encoding handled, we’ll turn our attention to the value of the
" 'runtimepath' option, since any scripts loaded from the paths specified
-" therein control so much of the behavior of Vim. I’d like to do this as
+" therein control so much of the behavior of Vim. We build this path up as
" accurately as possible, even with Vim’s unusual behavior around escaping of
" these variables. One of the first things we’ll need to be able to do is
" split the value of 'runtimepath' into its constituent path parts.
"
-" Splitting the values of comma-separated options correctly is surprisingly
-" complicated. The list separator for such options is more accurately defined
-" as follows:
+" Correctly splitting the values of comma-separated Vim options is
+" surprisingly complicated. The delimiter for such options is not simply
+" any comma; it is more accurately defined as follows:
"
-" │ A comma not preceded by a backslash, and possibly followed by an arbitrary
-" │ number of spaces and commas.
+" │ Any comma not preceded by a backslash, followed by any number of spaces
+" │ and commas.
"
-" The pattern required for the split breaks down like this:
+" The pattern required for the split therefore breaks down like this:
"
-" \\ ← Literal backslash
-" \@<! ← Negative lookbehind assertion; means that whatever occurred
-" before this pattern, here a backslash, cannot precede what
-" follows, but anything that does precede it is not removed from
-" the data as part of the split delimiter
-" , ← Literal comma
+" \\ ← A literal backslash
+" \@<! ← A negative lookbehind assertion; this means that whatever
+" occurred before this pattern, here a backslash, cannot precede
+" what follows, but anything that does precede it is not removed
+" from the data as part of the split delimiter
+" , ← A literal comma
" [, ]* ← Any number of commas and spaces
"
" We don’t, however, have to deal with backslashes before other backslashes,
" nor before any other character. You can read the source code for the ad-hoc
" tokenizer in copy_option_part() in src/misc2.c in Vim’s source code, and
-" test it with some values of your own, if you want to understand why. Vim,
-" I love you, but you are really weird sometimes.
+" test it with some values of your own, if you want to understand why.
"
-" We do all this with an autoloaded function option#Split().
+" Vim, I love you, but you are really weird sometimes.
"
-" We define an environment variable for ~/.vim or ~/vimfiles, by retrieving
-" the first value from the 'runtimepath', correctly split.
+" We do all this with an autoloaded function option#Split(); see
+" vim/autoload/option.vim. Provided a 'runtimepath' is actually set, using
+" the list returned from that function, we define an environment variable
+" MYVIM—to complement MYVIMRC—for ~/.vim or ~/vimfiles, by retrieving the
+" first value from the 'runtimepath'.
"
if &runtimepath !=# ''
let $MYVIM = option#Split(&runtimepath)[0]
endif
-" We'll use the XDG directories as machine-local configuration and storage.
+" The next components of the runtime directory that we'll set up here will be
+" the XDG base directories, for machine-local configuration and storage for
+" files outside this repository.
+"
" <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables>
"
" Add all the configuration directories to 'runtimepath', including "after"
@@ -391,14 +396,11 @@ set spellcapcheck=[.?!]\\%(\ \ \\\|[\\n\\r\\t]\\)
" In much the same way, we add an expected path to a thesaurus, for completion
" with CTRL-X CTRL-T in insert mode, or with ‘t’ added to 'completeopt'. The
" thesaurus data isn’t installed as part of the default ‘install-vim’ target
-" in tejr’s dotfiles, but it can be retrieved from
-" <https://sanctum.geek.nz/ref/thesaurus.txt>.
-"
-" I got the thesaurus itself from the link in the :help for 'thesaurus' in
-" v8.1. It’s from WordNet and MyThes-1. I maintain a mirror on my own
-" website that the Makefile recipe attempts to retrieve. I had to remove the
-" first two metadata lines from thesaurus.txt, as Vim appeared to interpret
-" them as part of the body data.
+" in tejr’s dotfiles, but a decent one can be retrieved from my website at
+" <https://sanctum.geek.nz/ref/thesaurus.txt>. I got this from the link in
+" the :help for 'thesaurus' in v8.1. It’s from WordNet and MyThes-1. I had
+" to remove the first two metadata lines from thesaurus.txt, as Vim appeared
+" to interpret them as part of the body data.
"
" Extra checks for appending the 'dictionary' and 'thesaurus' paths need to be
" made, because the P_NDNAME property is assigned to them, which enforces