diff options
-rw-r--r-- | bash/bashrc.d/vim.bash | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bash/bashrc.d/vim.bash b/bash/bashrc.d/vim.bash index cd8f3896..bcdcd86d 100644 --- a/bash/bashrc.d/vim.bash +++ b/bash/bashrc.d/vim.bash @@ -1,4 +1,11 @@ -# If Vim exists on the system, use it instead of vi +# If Vim exists on the system, use it instead of ex, vi, and view +ex() { + if hash vim 2>/dev/null; then + command vim -e "$@" + else + command ex "$@" + fi +} vi() { if hash vim 2>/dev/null; then command vim "$@" @@ -6,4 +13,11 @@ vi() { command vi "$@" fi } +view() { + if hash vim 2>/dev/null; then + command vim -R "$@" + else + command view "$@" + fi +} |