View previous topic :: View next topic |
Author |
Message |
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Tue Jan 28, 2025 8:27 pm Post subject: using NeoVIM as $EDITOR |
|
|
I've already chosen nvim with `eselect vi`, but I've noticed apps that use $EDITOR are still launching vim. When I went to `eselect editor`, I saw that `vim` is explicitly specified.
I know that I can explicitly enter the path to `nvim` here (and have done so), but I just wanted to ask: shouldn't `eselect editor` use the vi symbolic link, or nvim be shown as one of the choices instead?
When searching, I found this very old post that shows that `eselect editor` at least used to have `vi` instead of explicitly `vim` _________________ Back on the G after 15 years on the Cupertino Kool-aid
Last edited by bent on Tue Jan 28, 2025 11:47 pm; edited 1 time in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1999
|
Posted: Tue Jan 28, 2025 8:35 pm Post subject: |
|
|
eselect editor has a very short hard coded list in /usr/share/eselect/modules/editor.eselect
Specifically Code: | EDITOR_LIST="nano emacs vim" |
One could argue managing that list ad nauseam in bugs until the end of time or just free form your favorite editor instead. |
|
Back to top |
|
|
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Tue Jan 28, 2025 8:55 pm Post subject: |
|
|
grknight wrote: | One could argue managing that list ad nauseam in bugs until the end of time or just free form your favorite editor instead. |
Not what I want to do at all. Just seems that if `eselect vi` is intended as to manage which vi clone to use, then `eselect editor` should use that too rather than only have vim explicitly.
Found these bugs: 911792 930037. It looks like 911792 was asking why `vi` is not in the list, and it got 'fixed' by changing it to `vim`. Then 930037 is asking the same thing as I am, but got WONTFIX'ed.
IMO, 911792 was badly fixed, and now defeats the `eselect vi` setting. _________________ Back on the G after 15 years on the Cupertino Kool-aid |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6208 Location: Dallas area
|
Posted: Tue Jan 28, 2025 11:07 pm Post subject: |
|
|
Code: | $ grep EDITOR .bash_profile
export EDITOR=vi |
from /etc/profile
Code: | # You should override these in your ~/.bashrc (or equivalent) for per-user
# settings. For system defaults, you can add a new file in /etc/profile.d/.
export EDITOR=${EDITOR:-/bin/nano}
export PAGER=${PAGER:-/usr/bin/less} |
_________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
|
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Tue Jan 28, 2025 11:48 pm Post subject: |
|
|
I'm not trying to set an environment variable, thanks
I'm trying to start a discussion about counter-intuitive and surprising behaviour in eselect. _________________ Back on the G after 15 years on the Cupertino Kool-aid |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6208 Location: Dallas area
|
Posted: Wed Jan 29, 2025 12:32 am Post subject: |
|
|
What's counter intuitive?
from eselect 4.17
Code: | # list of most common cases only
EDITOR_LIST="nano ed emacs ex vi xemacs" |
from 4.27
Code: | # list of most common cases only
EDITOR_LIST="nano emacs vim" |
If you select what is deemed not a common case, you can always set it to whatever you want.
Would you expect them to list ever editor available? _________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
|
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Wed Jan 29, 2025 1:06 am Post subject: |
|
|
Anon-E-moose wrote: | What's counter intuitive?
from eselect 4.17
…
from 4.27
|
Notice the change from vi to vim across those versions? Where we previously had vi (which in turn points to whatever `eselect vi` is set to) and now we have vim, which… doesn't. That's counterintuitive.
Also, if vim is not installed, (but some other clone is, and set up properly with eselect), there's no vi(*) option shown at all. That's less intuitive than an agnostic `vi` option which could show as long as /usr/bin/vi exists.
Anon-E-moose wrote: | Would you expect them to list ever editor available? |
No, I expect eselect to be consistent with… eselect. _________________ Back on the G after 15 years on the Cupertino Kool-aid |
|
Back to top |
|
|
ingenarel n00b
Joined: 16 Jan 2025 Posts: 6
|
Posted: Wed Jan 29, 2025 8:24 am Post subject: |
|
|
might be a stupid fix, but i just have this in my zsh config:
Code: | export EDITOR="/usr/bin/nvim" |
|
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 534
|
Posted: Wed Jan 29, 2025 9:03 am Post subject: |
|
|
I think bent is expecting that if "eselect editor set vim" is used, that the $EDITOR environment variable is set to whatever symlink "eselect vi show" is pointing.
If "eselect vi" points to vim, setting "eselect editor set vim" is changing $EDITOR to vim.
If "eselect vi" points to nvim, setting "eselect editor set vim" is changing $EDITOR to nvim. |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6208 Location: Dallas area
|
Posted: Wed Jan 29, 2025 10:28 am Post subject: |
|
|
sMueggli wrote: | I think bent is expecting that if "eselect editor set vim" is used, that the $EDITOR environment variable is set to whatever symlink "eselect vi show" is pointing. |
Then I would say that his expectations were/are wrong.
The EDITOR variable has been around for a long time, far longer than gentoo or even linux,
and it's always been common practice to set it yourself in your .profile or equivalent. _________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
|
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Wed Jan 29, 2025 8:18 pm Post subject: |
|
|
sMueggli wrote: | I think bent is expecting that if "eselect editor set vim" is used, that the $EDITOR environment variable is set to whatever symlink "eselect vi show" is pointing. |
Nope. I am just proposing that `eselect editor list` show `vi` (not vim, not nvim, etc.), if any vi clone is installed. Otherwise, what's the point of `eselect vi set` existing, only for `eselect editor list` to simply ignore it and only work with one specific clone?
As it is now, `eselect editor list` only shows one vi clone: vim. Users of other clones will probably only see nano in the list. I know they can set it free-form, but they might not. They might wonder if there's some reason vi is not in the list. There is a reason, and it's a bad one: `eselect editor list` is hardcoded around vim, since https://bugs.gentoo.org/911792 _________________ Back on the G after 15 years on the Cupertino Kool-aid |
|
Back to top |
|
|
bent Tux's lil' helper
Joined: 26 Mar 2003 Posts: 89 Location: New Zealand
|
Posted: Wed Jan 29, 2025 11:19 pm Post subject: |
|
|
Here's the documentation that incorrectly tells users that installing (some vi clone other than vim) and symlinking vi to it will cause it to show in `eselect editor list`
Here's the (reopened) bug, if you want to see how this terrible saga plays out, and yes, I will die on this hill. _________________ Back on the G after 15 years on the Cupertino Kool-aid |
|
Back to top |
|
|
|