#14 alias vi=vim for root
Closed 3 years ago by zdohnal. Opened 3 years ago by sergiomb.
Unknown source master  into  master

file modified
+2 -4
@@ -1,7 +1,5 @@

  if ( -x /usr/bin/id ) then

-     if ( "`/usr/bin/id -u`" > 200 ) then

-         alias vi vim

-         alias view 'vim -R'

-     endif

+     alias vi vim

+     alias view 'vim -R'

  endif

  

file modified
-1
@@ -1,5 +1,4 @@

  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"

As suggested on devel Mailing List let's enable alias vi=vim for root

Hi Sergio,

thank you for the PR!

/usr is now mounted everytime (IIUC) and additional features are rather welcomed than being source of reports :) .

LGTM to remove the root exception when vim-enhanced is installed, but I will remake vim.sh as Jonathan suggested on mailing list to respect possible user stuff in /usr/local/bin.

Feel free to review then.

OK , where is the review ? my PR is against master

@sergiomb still working on the code - I'm now in verifying phase. I'm applying the changes which Jonathan suggested and created profile file for fish too.

So if you have an experience with tcsh and fish shells, feel free to contact me via irc (nick is the same) , the help will be appreciated.

Otherwise, I'll post a PR here once I'm done.

Pull-Request has been closed by zdohnal

3 years ago

Can you use command -v instead of which to avoid growing a dep on which?

@cyberpear Thanks for the tip! It even gives better output than type and which, so I can drop the redirecting to /dev/null in .sh and .fish and drop the double invocation in .csh.

Applied as commit https://src.fedoraproject.org/rpms/vim/c/4e95433cdedb1e2f02b7f94b878ad5bbe4e5d3f8?branch=master