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

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to