Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930037 - app-admin/eselect: vi doesn't show up on eselect editor list
Summary: app-admin/eselect: vi doesn't show up on eselect editor list
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor
Assignee: Gentoo eselect Team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 949057
  Show dependency tree
 
Reported: 2024-04-15 01:24 UTC by Guilherme Bember Duarte
Modified: 2025-02-02 18:28 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
make editor.eselect show vi symlink instead of vim directly (file_930037.txt,400 bytes, patch)
2025-01-29 21:35 UTC, Ben Torkington
Details | Diff
Update lists in editor and visual modules (0001-Update-lists-in-editor-and-visual-modules.patch,2.12 KB, patch)
2025-01-30 20:49 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Bember Duarte 2024-04-15 01:24:55 UTC
Because editors like vim and neovim won't be added to the editors list, and they are managed by eselect-vi, I thought vi should show up as one of the available editors in eselect editor list, but it actually doesn't, here are the outputs of eselect editor list and eselect vi list

Available targets for the EDITOR variable:
  [1]   /bin/vi * --this was chosen using free form
  [ ]   (free form)

Available vi implementations:
  [1]   nvim *
Comment 1 Paul Zander 2024-04-15 17:31:14 UTC
This looks like a result of https://bugs.gentoo.org/911792 where vi was dropped in favour of vim in the EDITOR list. But it seems removed the connection to the vi symlink controlled by eselect-vi.
Comment 2 Ulrich Müller gentoo-dev 2024-04-15 17:53:03 UTC

*** This bug has been marked as a duplicate of bug 928607 ***
Comment 3 Guilherme Bember Duarte 2024-04-15 18:07:02 UTC
(In reply to Paul Zander from comment #1)
> This looks like a result of https://bugs.gentoo.org/911792 where vi was
> dropped in favour of vim in the EDITOR list. But it seems removed the
> connection to the vi symlink controlled by eselect-vi.

What I read here in the bugtracker was that Vim wouldn't be added for the same reason Nvim wouldn't be added, to keep the list short and simple, because all of those vi-like editors should be managed with eselect-vi
Comment 4 Ben Torkington 2025-01-28 21:33:41 UTC
I think this bug was prematurely closed.

If I have nvim AND vim installed, `eselect vi list` shows them both (expected). `eselect editor list` shows only vim, which is surprising. I expected to see `vi`, and I infer (initially) that there's some reason vim explicitly appears but the vi symlink doesn't.

I know I can set editor explicitly to either vi (which seems the best choice, since that's the point of eselect) or vim or nvim explicitly. And if I didn't care, I probably would. But when I see a specific vi clone listed instead of the agnostic symlink, my instinct is to find out *why*.

In trying to find out why, I went down a rabbit-hole that got me to #911792. Someone was apparently confused as to why vi was in the list, but vim wasn't. The end result of that bug was vi was removed in favour of vim. I feel like this was backwards, the behaviour was correct in the first place and the user needed educating.
Comment 5 Guilherme Bember Duarte 2025-01-28 22:07:33 UTC
I think you're right, I only have vi in the 'eselect editor' list because I manually added it. I'll reopen this. thanks
Comment 6 Ben Torkington 2025-01-29 02:49:54 UTC
Thanks Guilherme.

Ulrich, can you please reconsider whether this really is a dupe of bug 928607? It seems that but was asking for individual vim clones to be added, and bug 911792 seems to have resulted in a regression where vim, and only vim are included in `eselect editor list`.

This seems inconsistent with the purpose of `eselect vi`, and only appears when vim itself is installed, not any of the other vi clones. What's being proposed here is a return to vi (and only vi) appearing in `eselect editor list`.
Comment 7 Ulrich Müller gentoo-dev 2025-01-29 07:30:12 UTC
Please read bug 190216 comment #2 and bug 911792 comment #8.

*** This bug has been marked as a duplicate of bug 928607 ***
Comment 8 Ben Torkington 2025-01-29 19:55:54 UTC
I have. I am not proposing listing any more editors in `eselect editor`.

I am only suggesting that it show vi (the symlink) instead of vim (one specific vi clone).

As it is now: Users with vim installed will see it `eselect editor list`, but users of any other vi clone will probably only see nano.

What I'm proposing: Users with *any* vi clone installed will see `vi` in the list, which will launch whatever they set with `eselect vi`, without caring about which vi clone is used.

This is the way it was before 911792. The reporter of that bug seemed confused that `vim` wasn't listed, when a perfectly good symlink to `vi` was. In doing so, a system that was agnostic to which vi clone was used became a system that only honours vim and ignores that rest. That's a regression.
Comment 9 Guilherme Bember Duarte 2025-01-29 20:10:09 UTC
Talking about other Vi clones, AFAIK, there isn't a way to set neovim as your default editor without adding it manually
Comment 10 Ben Torkington 2025-01-29 20:31:51 UTC
There was, until bug 911792

Then:

emerge nvim
eselect vi list       # << shows nvim, so we set it
eselect editor list   # << shows nano and vi (which points to nvim), so we set it

Now:

emerge nvim
eselect vi list       # << shows nvim, so we set it
eselect editor list   # << "Available targets for the EDITOR variable: nano"
Comment 11 Guilherme Bember Duarte 2025-01-29 20:36:19 UTC
I guess there's no point in reopening this bug as it will probably be marked as a duplicate again, do you think it's better to reopen it anyway or you creating a new report?
Comment 12 Ben Torkington 2025-01-29 20:51:52 UTC
I don't know. I thought your initial description of the bug was perfect and was just misunderstood and closed as a dupe.

I've thrashed this out on IRC, the forums and here on Bugzilla and people keep telling me to just set $EDITOR freeform, and move on.

The fix is literally to delete a single character. I'm not trying to make life easy for myself, I'm trying to stop a potential source of confusion for new eselect users, otherwise I'd just patch it locally and move on.

I've seen this kind of situation play out enough in closed and open source to know the best approach is to just give up.
Comment 13 Guilherme Bember Duarte 2025-01-29 20:59:53 UTC
I'll reopen this once again, let's see how things play out.
Just to recap:
The current way eselect editor and eselect vi works makes it impossible to set Vi clones/alternatives as your default text editor with the default options provided. You can still set it manually but that can confuse people unfamiliar with the eselect tool and is plain unintuitive. This happens because the way things are now, nvim doesn't show up under 'eselect vi list' and because you can't set what you want to use for vi, you can't choose vi (or nvim in this case) as your default editor. As Ben said here before, the fix is simply and can help Gentoo newcomers, making eselect more intuitive
Comment 14 Ben Torkington 2025-01-29 21:35:48 UTC
Created attachment 917884 [details, diff]
make editor.eselect show vi symlink instead of vim directly

This makes `eselect list` helpful to users who have some vi clone other than vim installed.
Comment 15 Guilherme Bember Duarte 2025-01-29 21:45:35 UTC
(In reply to Guilherme Bember Duarte from comment #13)
> I'll reopen this once again, let's see how things play out.
> Just to recap:
> The current way eselect editor and eselect vi works makes it impossible to
> set Vi clones/alternatives as your default text editor with the default
> options provided. You can still set it manually but that can confuse people
> unfamiliar with the eselect tool and is plain unintuitive. This happens
> because the way things are now, nvim doesn't show up under 'eselect vi list'
> and because you can't set what you want to use for vi, you can't choose vi
> (or nvim in this case) as your default editor. As Ben said here before, the
> fix is simply and can help Gentoo newcomers, making eselect more intuitive

I made a mistake here, neovim does shows up under "eselect vi list", but vi doesn't show up under "eselect editor list", the rest still applies, it's inconvenient and unintuitive to set nvim (or any other Vi alternative for that matter) as your default editor, be that trough directly choosing nvim or the vi symlink.
The fix, would be adding vi as a possible editor for "eselect editor" (and removing vim to keep things consistent), just as Ben said.
Comment 16 Ben Torkington 2025-01-29 21:57:07 UTC
oof, I've made that mistake enough times that surely hasn't helped me being understood. Typo aside, your wording is clearer than mine, and I appreciate you joining on me on this, the most trivial of crusades.

I've submitted a patch, tested on systems with neovim, vim, and neither. Fingers crossed.
Comment 17 Guilherme Bember Duarte 2025-01-29 22:01:04 UTC
I must thank you for reminding me about this, I had already given up on making a change. And I must admit, I'm glad I could word this problem as well as you said I did, English isn't my first language!
Comment 18 Ulrich Müller gentoo-dev 2025-01-29 22:32:37 UTC
CCing vim team. Please advise.

tl;dr The question is whether we should keep "nano emacs vim" as choices for the editor.eselect module, or change it to "nano emacs vi" in this line:
https://gitweb.gentoo.org/proj/eselect.git/tree/modules/editor.eselect#n8

Note 1: It is already possible to set the editor symlink to vi, like this:

   # eselect editor set vi
   Setting EDITOR to vi ...
   Run ". /etc/profile" to update the variable in your shell.

Once set, the active option _will_ be listed:

   # eselect editor list
   Available targets for the EDITOR variable:
     [1]   nano
     [2]   emacs
     [3]   vim
     [4]   vi *
     [ ]   (free form)

Note 2: This was changed from "vi" to "vim" previously:
https://gitweb.gentoo.org/proj/eselect.git/commit/modules/editor.eselect?id=e1577d699cfc3eb60b245c8488062a43e8cece22

Note 3: We won't have both. (We won't have multiple Emacs variants either. Changing the list to anything other than the bare minimum will only cause more bugs like this to be filed. Also, trying to maintain a comprehensive list is hopeless.)
Comment 19 Guilherme Bember Duarte 2025-01-29 22:35:28 UTC
Because Vim can be considered a Vi alternative/clone, I reckon it would be better to replace it with Vi under 'eselect editor' to keep it consistent with the other Vi-like editors.
Comment 20 Ben Torkington 2025-01-29 23:07:39 UTC
Thanks for escalating this, Ulrich.

Just so we're clear, here's *why* I think it's confusing. Not to me, but to someone using eselect for the first time. I'm talking a new user experience here, not us folks who've used Gentoo for many years and have forgotten just how daunting it can be to set up.

(assuming they've already installed neovim because someone told them it's nice)

# eselect editor list
Available targets for the EDITOR variable:
  [1]   nano *
  [ ]   (free form)

--

Emphasis on the word *available*. The know neovim is installed, but for some reason it's not listed as *available*. That implies it's *not available* as a choice, which is misleading. They might infer neovim is considered an inappropriate choice for $EDITOR (especially considering Gentoo's seeming affinity for nano)

It doesn't help that https://wiki.gentoo.org/wiki/Text_editor documentation is now wrong, stating that installing [vi clone] and symlinking vi to will make it available in the eselect list, which is no longer does. Boom: forum post, bug opened, chastised at on IRC (happened to me yesterday).

Gentoo is proudly about choice. The choices should have an even footing.

Sorry I'm ranty an exasperated. I've spent hours arguing this, been told to RTF(incorrect)M, just set my env and move on, when I'm trying to smooth out what is probably the most trivial fix for a minor pinch point for new users.

It just seems so inelegant and un-Unix-ish for one part of eselect to exist solely to set up a vi symlink, only for another part of eselect to completely ignore it.
Comment 21 Paul Zander 2025-01-30 12:46:45 UTC
Available targets for the EDITOR variable:
  [ ]   (free form)

It's not that hard.
Comment 22 Ben Torkington 2025-01-30 19:02:06 UTC
It's not that hard to put a bucket on the floor to catch the drops from a leaky roof, either.

But it's better to fix the roof.
Comment 23 Ulrich Müller gentoo-dev 2025-01-30 20:49:46 UTC
Created attachment 917982 [details, diff]
Update lists in editor and visual modules

Let's (re-)add some choices:
- Those that were previously removed in bug 911792 (except sys-apps/ed)
- app-editors/mg because it is on some of our install media
Comment 24 Ben Torkington 2025-01-31 02:13:59 UTC
I'm guessing 'vim' was left in 0001-Update-lists-in-editor-and-visual-modules.patch by accident?

(In reply to Ulrich Müller from comment #18)
> 
> Note 3: We won't have both.

Anyway, thanks.
Comment 25 Ulrich Müller gentoo-dev 2025-01-31 06:48:43 UTC
(In reply to Ben Torkington from comment #24)
> I'm guessing 'vim' was left in
> 0001-Update-lists-in-editor-and-visual-modules.patch by accident?

Actually, I left it in on purpose. It is not a "pure" solution, but inevitably (other) people would complain if vim was removed from the list.
Comment 26 Larry the Git Cow gentoo-dev 2025-02-02 14:35:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/eselect.git/commit/?id=4276f64b8b0417a7535313dd266d6faefc071ed1

commit 4276f64b8b0417a7535313dd266d6faefc071ed1
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2025-01-30 20:42:45 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2025-01-30 20:42:45 +0000

    Update lists in editor and visual modules
    
    * modules/editor.eselect (EDITOR_LIST):
    * modules/visual.eselect (EDITOR_LIST): (Re-)add ex, mg, vi
    and xemacs. Bug 930037.
    
    Bug: https://bugs.gentoo.org/930037
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 ChangeLog              | 6 ++++++
 modules/editor.eselect | 4 ++--
 modules/visual.eselect | 4 ++--
 3 files changed, 10 insertions(+), 4 deletions(-)
Comment 27 Larry the Git Cow gentoo-dev 2025-02-02 18:28:35 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e43431bd26a31be3cf420a123d2ff6300ab037c2

commit e43431bd26a31be3cf420a123d2ff6300ab037c2
Author:     Ulrich Müller <ulm@gentoo.org>
AuthorDate: 2025-02-02 18:21:28 +0000
Commit:     Ulrich Müller <ulm@gentoo.org>
CommitDate: 2025-02-02 18:26:31 +0000

    app-admin/eselect: add 1.4.29
    
    Closes: https://bugs.gentoo.org/930037
    Signed-off-by: Ulrich Müller <ulm@gentoo.org>

 app-admin/eselect/Manifest              |  1 +
 app-admin/eselect/eselect-1.4.29.ebuild | 61 +++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)