aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-10 10:49:37 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-10 10:49:37 +1300
commit4c53b9d6552954938cfdc46ee4cc2a5b524a9f60 (patch)
tree17573ee81f2cae7ea13c4ea4b2e7a12eb1bcc9bf /sh
parentMerge branch 'master' into port/bsd/freebsd (diff)
parentCorrect two manual references (diff)
downloaddotfiles-4c53b9d6552954938cfdc46ee4cc2a5b524a9f60.tar.gz
dotfiles-4c53b9d6552954938cfdc46ee4cc2a5b524a9f60.zip
Merge branch 'master' into port/bsd/freebsd
Diffstat (limited to 'sh')
-rw-r--r--sh/profile.d/editor.sh8
-rw-r--r--sh/profile.d/plenv.sh5
-rw-r--r--sh/profile.d/visual.sh8
-rw-r--r--sh/shrc.d/plenv.sh17
-rw-r--r--sh/shrc.d/vim.sh13
5 files changed, 34 insertions, 17 deletions
diff --git a/sh/profile.d/editor.sh b/sh/profile.d/editor.sh
index ee0da70b..5d6b249e 100644
--- a/sh/profile.d/editor.sh
+++ b/sh/profile.d/editor.sh
@@ -1,3 +1,7 @@
-# Set command-line editor
-EDITOR=ed
+# Set command-line editor; ed if we've got it (!), but ex will do fine
+if command -v ed >/dev/null 2>&1 ; then
+ EDITOR=ed
+else
+ EDITOR=ex
+fi
export EDITOR
diff --git a/sh/profile.d/plenv.sh b/sh/profile.d/plenv.sh
new file mode 100644
index 00000000..b2b491e1
--- /dev/null
+++ b/sh/profile.d/plenv.sh
@@ -0,0 +1,5 @@
+# Add plenv to PATH and MANPATH if it appears to be in use
+[ -d "$HOME"/.plenv ] || return
+PATH=$HOME/.plenv/shims:$HOME/.plenv/bin:$PATH
+MANPATH=$HOME/.plenv/versions/$(perl -e 'print substr($^V,1)')/man:$MANPATH
+export MANPATH
diff --git a/sh/profile.d/visual.sh b/sh/profile.d/visual.sh
index 95eb1d5d..d03da255 100644
--- a/sh/profile.d/visual.sh
+++ b/sh/profile.d/visual.sh
@@ -1,3 +1,7 @@
-# Set visual editor
-VISUAL=vi
+# Set visual editor; vim if we've got it, but vi will do fine
+if command -v vim >/dev/null 2>&1 ; then
+ VISUAL=vim
+else
+ VISUAL=vi
+fi
export VISUAL
diff --git a/sh/shrc.d/plenv.sh b/sh/shrc.d/plenv.sh
new file mode 100644
index 00000000..6e03618e
--- /dev/null
+++ b/sh/shrc.d/plenv.sh
@@ -0,0 +1,17 @@
+# POSIX-compatible version of the plenv Bash shell wrapper
+[ -d "$HOME"/.plenv ] || return
+plenv() {
+ case $1 in
+ rehash)
+ shift
+ eval "$(plenv sh-rehash "$@")"
+ ;;
+ shell)
+ shift
+ eval "$(plenv sh-shell "$@")"
+ ;;
+ *)
+ command plenv "$@"
+ ;;
+ esac
+}
diff --git a/sh/shrc.d/vim.sh b/sh/shrc.d/vim.sh
deleted file mode 100644
index e9174082..00000000
--- a/sh/shrc.d/vim.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-# If Vim exists on the system, use it instead of ex, vi, and view
-command -v vim >/dev/null 2>&1 || return
-
-# Define functions proper
-ex() {
- vim -e "$@"
-}
-vi() {
- vim "$@"
-}
-view() {
- vim -R "$@"
-}