aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/ed.bash
blob: 5a54c761fccaf715b6b42c2af6bcf9cd08397dbd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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. Also try and use -v for more verbose error output.
ed() {
    if [[ -t 0 ]] ; then
        if ed -sv - </dev/null >/dev/null 2>&1 ; then
            command ed -vp: "$@"
        else
            command ed -p: "$@"
        fi
    else
        command ed "$@"
    fi
}