vim/vim.sh
Zane Bitter 662d92a10a Alias view to "vim -R" when available
We already alias "vi" to "vim" when the vim-enhanced package is
installed. However, /usr/bin/view is a symlink to vi, which results in
inconsistent behavior between the two - the "vi" command runs in vim
mode, but the "view" command runs in vi mode. Alias "view" to "vim -R"
when vim-enhanced is available so that these are consistent.
2020-07-31 14:45:17 -04:00

7 lines
300 B
Bash

if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; then
[ "`/usr/bin/id -u 2>/dev/null || echo 0`" -le 200 ] && return
# for bash and zsh, only if no alias is already set
alias vi >/dev/null 2>&1 || alias vi=vim
alias view >/dev/null 2>&1 || alias view="vim -R"
fi