aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2013-09-09 01:09:06 +1200
committerTom Ryder <tom@sanctum.geek.nz>2013-09-09 01:09:06 +1200
commit99d59a46705ce1f9284a32130a1fe267abbe31e7 (patch)
tree743a295384c99712bed0941be40e8eb639e46980 /bash
parentTest explicitly for 256 colors (diff)
downloaddotfiles-99d59a46705ce1f9284a32130a1fe267abbe31e7.tar.gz
dotfiles-99d59a46705ce1f9284a32130a1fe267abbe31e7.zip
Improve ed(1) abstraction
Diffstat (limited to 'bash')
-rw-r--r--bash/bashrc.d/aliases.bash4
-rw-r--r--bash/bashrc.d/ed.bash11
2 files changed, 11 insertions, 4 deletions
diff --git a/bash/bashrc.d/aliases.bash b/bash/bashrc.d/aliases.bash
index 53b49e69..31296b7c 100644
--- a/bash/bashrc.d/aliases.bash
+++ b/bash/bashrc.d/aliases.bash
@@ -1,10 +1,6 @@
# Use a unified format for diff by default
alias diff='diff -u'
-# Add a colon prompt to ed when a command is expected rather than text; makes
-# it feel a lot more like using ex
-alias ed='ed -p:'
-
# Don't print the GDB copyright message on every invocation
alias gdb='gdb -q'
diff --git a/bash/bashrc.d/ed.bash b/bash/bashrc.d/ed.bash
new file mode 100644
index 00000000..d4d92158
--- /dev/null
+++ b/bash/bashrc.d/ed.bash
@@ -0,0 +1,11 @@
+# Add a colon prompt to ed when a command is expected rather than text; makes
+# it feel a lot more like using ex. Only do this when stdin is a terminal,
+# however.
+ed() {
+ if [[ -t 0 ]]; then
+ command ed -p: "$@"
+ else
+ command ed "$@"
+ fi
+}
+