public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Lee <ler762@gmail.com>
To: matthew patton <pattonme@yahoo.com>
Cc: marco atzeri <marco.atzeri@gmail.com>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: vim: errors launching "/usr/bin/vi
Date: Wed, 20 Dec 2023 14:23:49 -0500	[thread overview]
Message-ID: <CAD8GWsu7hFAgAZQBzDf5_YO_GfWCxn=6dNMtg092Bq9XUFQDyw@mail.gmail.com> (raw)
In-Reply-To: <13058478.2154617.1703098667904@mail.yahoo.com>

On Wed, Dec 20, 2023 at 1:57 PM matthew patton wrote:
>
> > Would you please let me know how to make an /etc/alternatives for vi/vim?
>
> did you install the alternatives package?

I installed cygwin back in 2017; I don't remember what all I've
installed but it seems to be there:
$ ls -l /usr/sbin/alt*
-rwxr-xr-x 1 root None 20499 Apr  4  2013 /usr/sbin/alternatives.exe

> I just use aliases (actually I set EDITOR=xxx) after I enumerate the editors I consider worthy of inclusion and resident.

That's my current work-around

# set the bash prompt
#   "$SHLVL" = 1 is true for the 1st shell, and incremented
#   each time another instance of bash is started.  eg
#     vi /tmp/foo
#     :sh
#   and you're in a new shell so SHLVL was incremented
#
if [  "$SHLVL" = 1 ]; then
    PS1='\[\e]2;\u@\h  \w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
else
    PS1='\[\e]2;\u@\h  \w\a\]\n\u@\h \w\n\$ '
    alias vi=vim
fi

> What DOES need nuking is the forced alias in /etc/profile.d. That's inexcusable interference in the system.

I'd say vi/vim needs to be put under /etc/alternatives
If anyone has access to a redhat linux system, do they 'alias vi=vim'
or put vi under /etc/alternatives?

Debian uses alternatives:
$ update-alternatives --query vi
Name: vi
Link: /usr/bin/vi
Slaves:
 vi.1.gz /usr/share/man/man1/vi.1.gz
 vi.da.1.gz /usr/share/man/da/man1/vi.1.gz
 vi.de.1.gz /usr/share/man/de/man1/vi.1.gz
 vi.fr.1.gz /usr/share/man/fr/man1/vi.1.gz
 vi.it.1.gz /usr/share/man/it/man1/vi.1.gz
 vi.ja.1.gz /usr/share/man/ja/man1/vi.1.gz
 vi.pl.1.gz /usr/share/man/pl/man1/vi.1.gz
 vi.ru.1.gz /usr/share/man/ru/man1/vi.1.gz
Status: auto
Best: /usr/bin/vim.basic
Value: /usr/bin/vim.basic

Alternative: /usr/bin/vim.basic
Priority: 30
Slaves:
 vi.1.gz /usr/share/man/man1/vim.1.gz
 vi.da.1.gz /usr/share/man/da/man1/vim.1.gz
 vi.de.1.gz /usr/share/man/de/man1/vim.1.gz
 vi.fr.1.gz /usr/share/man/fr/man1/vim.1.gz
 vi.it.1.gz /usr/share/man/it/man1/vim.1.gz
 vi.ja.1.gz /usr/share/man/ja/man1/vim.1.gz
 vi.pl.1.gz /usr/share/man/pl/man1/vim.1.gz
 vi.ru.1.gz /usr/share/man/ru/man1/vim.1.gz

$ update-alternatives --query vim
Name: vim
Link: /usr/bin/vim
Status: auto
Best: /usr/bin/vim.basic
Value: /usr/bin/vim.basic

Alternative: /usr/bin/vim.basic
Priority: 30

Regards,
Lee

  reply	other threads:[~2023-12-20 19:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <da2e8ab5-f0ad-425f-a64d-fbda732fdf0c.ref@pacbell.net>
2023-12-20  2:47 ` Beau James
2023-12-20  5:04   ` Marco Atzeri
2023-12-20 14:00     ` marco atzeri
2023-12-20 18:34       ` Lee
2023-12-20 18:57         ` matthew patton
2023-12-20 19:23           ` Lee [this message]
2023-12-20 19:45             ` gs-cygwin.com
2023-12-20 20:10               ` Lee
2023-12-20 19:24         ` Ken Brown
2023-12-20 19:30           ` matthew patton
2023-12-20 19:44             ` Brian Inglis
2023-12-20 19:47               ` matthew patton
2023-12-21  3:01                 ` Brian Inglis
2023-12-20 20:04               ` Lee
2023-12-20 19:55             ` Lee
2023-12-20 19:44           ` Lee
2023-12-20 19:54             ` matthew patton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAD8GWsu7hFAgAZQBzDf5_YO_GfWCxn=6dNMtg092Bq9XUFQDyw@mail.gmail.com' \
    --to=ler762@gmail.com \
    --cc=cygwin@cygwin.com \
    --cc=marco.atzeri@gmail.com \
    --cc=pattonme@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).