Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

feat: display editor setting #2271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m-ildefons
Copy link

@m-ildefons m-ildefons commented Dec 28, 2022

Screenshot at 2022-12-28 17-31-19

Display the configured editor, version and path using the $EDITOR environment variable similar to the way the shell version is displayed from the $SHELL variable.

fixes: #2270

TODO

  • Manpage

@hykilpikonna
Copy link

Currently, if neither $VISUAL nor $EDITOR is set, the code will return "command not found" when trying to run $editor_full_path when it's empty. Can you add a null check or ignore stderr?

image

image

@hykilpikonna
Copy link

You can add

[[ -z "$editor_full_path" ]] && return

Display the configured editor, version and path using the $EDITOR
environment variable similar to the way the shell version is displayed
from the $SHELL variable.

fixes: dylanaraps#2270
@m-ildefons
Copy link
Author

Hi,
thanks for pointing this out. I corrected it and also added the options to the man page.
It will still fail to execute if $VISUAL (or $EDITOR) is set to something that isn't executable, but that would be quite a rare misconfiguration, so I'm not sure it's worth handling this case?

hykilpikonna added a commit to hykilpikonna/hyfetch that referenced this pull request Dec 29, 2022
Upstream PR: dylanaraps#2271
Thanks to @m-ildefons

Co-authored-by: Moritz Röhrich <moritz@ildefons.de>
@hykilpikonna
Copy link

Works!

image

@hykilpikonna
Copy link

It will still fail to execute if $VISUAL (or $EDITOR) is set to something that isn't executable, but that would be quite a rare misconfiguration, so I'm not sure it's worth handling this case?

Yea that's fine, we can assume that EDITOR is correctly configured

@hykilpikonna
Copy link

Thank you for your contribution!

This PR is merged into hyfetch since this repo (dylanaraps/neofetch) seems no longer maintained.

HyFetch is a fork of neofetch with LGBTQ pride flags, but the repo also maintains an updated version of the original neofetch, addressing many pull requests that are not merged in the original repo.

Read the "Running Updated Original Neofetch" section for more info!

@hykilpikonna
Copy link

Found another bug - when the editor doesn't support --version option (the pico editor for example), neofetch will be stuck on this line:

image

And by default, macOS links nano to pico:

image

Therefore, I removed the version check for editor so that editors that doesn't support --version will now be unstuck.

hykilpikonna added a commit to hykilpikonna/hyfetch that referenced this pull request Aug 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] display editor of choice if the $EDITOR variable is set
2 participants