Re: our containers with alias vim=vi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have just noticed in f33 container, this change was implemented:

[root@9c06602a8aa6 ~]# vim /etc/yum.repos.d/x.repo
No vim found, using vi, press ENTER to continue

It's much much better, thank you a lot to the maintainer (probably Zdenek)!

On Wed, 14 Oct 2020 at 13:29, Jonathan Wakely <jwakely@xxxxxxxxxxxxxxxxx> wrote:
>
> On 13/10/20 16:04 +0200, Zdenek Dohnal wrote:
> >On 10/13/20 12:34 PM, Jonathan Wakely wrote:
> >> On 13/10/20 07:45 +0200, Zdenek Dohnal wrote:
> >>>
> >>> On 10/12/20 5:15 PM, Joe Doss wrote:
> >>>> On 10/12/20 1:50 AM, Zdenek Dohnal wrote:
> >>>>> This would break using Vim when vim-minimal and vim-enhanced are
> >>>>> installed (it would start Vi instead of typed Vim). To make it work,
> >>>>> vim-minimal would have to conflict with vim-enhanced, which doesn't
> >>>>> make
> >>>>> sense - Vi and Vim binaries can exist together just fine.
> >>>>
> >>>> I have vim-enhanced and vim-minimal installed
> >>>>
> >>>> # rpm -qa |grep vim
> >>>> vim-common-8.2.1770-1.fc33.x86_64
> >>>> vim-filesystem-8.2.1770-1.fc33.noarch
> >>>> vim-minimal-8.2.1770-1.fc33.x86_64
> >>>> vim-enhanced-8.2.1770-1.fc33.x86_64
> >>>>
> >>>> and when I type vi it launches vim.
> >>> I'm sorry I forgot about this alias - yes, there is an alias which is
> >>> applied when both - vim-minimal and vim-enhanced - are installed so it
> >>> launches 'vim' when you type 'vi'. I would say less people will complain
> >>> if something has more features than if it has less, so I'm content with
> >>> this alias.
> >>>>
> >>>> # whereis vi
> >>>> vi: /usr/bin/vi /usr/share/man/man1p/vi.1p.gz
> >>>> /usr/share/man/man1/vi.1.gz
> >>>> # /usr/bin/vi --version
> >>>> VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 29 2020 00:00:00)
> >>>>
> >>>> It doesn't look like these are existing together just fine. It seems
> >>>> that vim takes over vi. Shouldn't these conflict and only one can be
> >>>> installed over the other?
> >>> 'Vi' as the original project is no longer (I'm not sure for how long)
> >>> shipped in Fedora. 'Vi' we ship is just 'VIM' compiled with 'small' set
> >>> of features (f.e. without syntax highlighting) to mimic the original
> >>> 'Vi'. So if you run 'vi --version' it always shows 'VIM'.
> >>>>
> >>>>> In the end I find it incorrect to mislead users by default by telling
> >>>>> them 'Vim works' but Vi is run instead - Vi and Vim don't have the
> >>>>> same
> >>>>> set of features, which may lead into bug reports caused by this
> >>>>> mistake.
> >>>>
> >>>> Isn't that the reverse behavior detailed above? I type vi on Fedora
> >>>> Workstation it launches vim? I assume this isn't causing bug reports.
> >>> You're right, as I wrote above - aliasing vi->vim doesn't seem as a
> >>> problem to me, but aliasing vim->vi as clime suggested can cause mislead
> >>> for users.
> >>
> >> I would also appreciate if "vim" ran the executable installed by
> >> vim-minimal. I frequently type "vim" on servers I don't own and then
> >> grumble that it fails and I have to run "vi" instead. It **is** vim,
> >> it's just not installed with that name.  Insisting that users call it
> >> vi when we know it's vim and they know it's vim seems unnecessary.
> >
> >It's Vim but with a different set of features - VIM compiled as Vi
> >binary is trying to be small, kind of simulate Vi behavior without
> >setting 'compatible'.
> >
> >Since you know it has less features, good for you. But unfortunately,
> >not all users know - there was already a report about Vim missing
> >highlighting, and the reporter was running /usr/bin/vi. So my aim is to
> >prevent such a report.
> >
> >>
> >> $ rpm -qf /usr/bin/vi
> >> vim-minimal-8.2.1770-1.fc32.x86_64
> >>
> >> Could vim-minimal and vim-enhanced both install the same
> >> /etc/profile.d/vim.sh file that did something like this?
> >Installing the same file would mean to set conflicts between those two
> >package, wouldn't it? Or would you mind explaining how to achieve it?
>
> RPM allows a file to be owned by more than one package. Fedora has
> allowed this for eight years:
> https://pagure.io/packaging-committee/issue/138
> https://docs.fedoraproject.org/en-US/packaging-guidelines/#_file_and_directory_ownership
>
> The file would be owned by both packages, and only removed if both
> packages get removed. That means it would be present if at least one
> of them was installed.
>
> >>
> >> 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 and ksh and zsh
> >> Â  case "$(type -t vim)-$(type -t vi)" in
> >> Â Â Â  file-file)
> >> Â Â Â Â Â  # both vim and vi are present
> >> Â Â Â Â Â  alias vi=vim
> >> Â Â Â Â Â  alias view="vim -R"
> >> Â Â Â Â Â  ;;
> >> Â Â Â  -file)
> >> Â Â Â Â Â  # only vim-minimal is installed, expose it as 'vim' too
> >> Â Â Â Â Â  alias vim=vi
> >> Â Â Â Â Â  ;;
> >> Â  esac
> >> fi
> >>
> >Looks good, although it doesn't touch the problem mistaking Vi and Vim
> >as I said before. I tried to come up with a little bash script which
> >will mention it really runs vi instead of typed vim (just the important
> >snippet):
> >
> >alias vim="read -rep $'No vim found, using vi, press ENTER to
> >continue\n' -n1 -t 20 -s && vi"
> >
> >This can be add into bash profile instead of 'alias vim=vi' when only
> >vim-minimal is installed.
> >
> >Does it work for our case? IMO only problem would be with scripting, but
> >scripts which depend on vim and run on machine without vim-enhanced are
> >broken even now, so it shouldn't be a problem here.
>
> That would work for me.
> _______________________________________________
> devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux