aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ed.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/bashrc.d/ed.bash
parentTest explicitly for 256 colors (diff)
downloaddotfiles-99d59a46705ce1f9284a32130a1fe267abbe31e7.tar.gz
dotfiles-99d59a46705ce1f9284a32130a1fe267abbe31e7.zip
Improve ed(1) abstraction
Diffstat (limited to 'bash/bashrc.d/ed.bash')
-rw-r--r--bash/bashrc.d/ed.bash11
1 files changed, 11 insertions, 0 deletions
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
+}
+