From 662d92a10a2cf7ab21a3d9ce458bd29f58f05b6d Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Fri, 31 Jul 2020 14:29:21 -0400 Subject: [PATCH] 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. --- vim.csh | 1 + vim.sh | 1 + vim.spec | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vim.csh b/vim.csh index bb9ceb14..1ccfb378 100644 --- a/vim.csh +++ b/vim.csh @@ -1,6 +1,7 @@ if ( -x /usr/bin/id ) then if ( "`/usr/bin/id -u`" > 200 ) then alias vi vim + alias view 'vim -R' endif endif diff --git a/vim.sh b/vim.sh index 1e4ff789..dc3df471 100644 --- a/vim.sh +++ b/vim.sh @@ -2,4 +2,5 @@ if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; th [ "`/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 diff --git a/vim.spec b/vim.spec index 5f7bf319..a984b5cd 100644 --- a/vim.spec +++ b/vim.spec @@ -21,7 +21,7 @@ Summary: The VIM editor URL: http://www.vim.org/ Name: vim Version: %{baseversion}.%{patchlevel} -Release: 1%{?dist} +Release: 2%{?dist} License: Vim and MIT Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 Source1: vim.sh @@ -775,6 +775,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags %{_datadir}/icons/locolor/*/apps/* %changelog +* Fri Jul 31 2020 Zane Bitter - 2:8.2.1328-2 +- Alias view to "vim -R" when available + * Fri Jul 31 2020 Zdenek Dohnal - 2:8.2.1328-1 - patchlevel 1328