From 473fb28e9113b374eb7b964b57cffa495a5e0fbc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 7 Aug 2018 14:51:15 +1200 Subject: Add e() and v() wrappers --- README.md | 3 +++ sh/shrc.d/e.sh | 4 ++++ sh/shrc.d/v.sh | 4 ++++ 3 files changed, 11 insertions(+) create mode 100644 sh/shrc.d/e.sh create mode 100644 sh/shrc.d/v.sh diff --git a/README.md b/README.md index 6c88ad44..eb8ccb94 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,9 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include: * `ud()` changes into an indexed ancestor of a directory. * `vr()` tries to change to the root directory of a source control repository. +* Two editor wrapper functions: + * `e()` invokes `$EDITOR`, or `ed(1)` if not set. + * `v()` invokes `$VISUAL`, or `vi(1)` if not set. * `bc()` silences startup messages from GNU `bc(1)`. * `ed()` tries to get verbose error messages, a prompt, and a Readline environment for `ed(1)`. diff --git a/sh/shrc.d/e.sh b/sh/shrc.d/e.sh new file mode 100644 index 00000000..776b242c --- /dev/null +++ b/sh/shrc.d/e.sh @@ -0,0 +1,4 @@ +# Invoke $EDITOR +e() { + "${EDITOR:-ed}" "$@" +} diff --git a/sh/shrc.d/v.sh b/sh/shrc.d/v.sh new file mode 100644 index 00000000..a5fa147c --- /dev/null +++ b/sh/shrc.d/v.sh @@ -0,0 +1,4 @@ +# Invoke $VISUAL +v() { + "${VISUAL:-vi}" "$@" +} -- cgit v1.2.3