Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default editor to in-terminal #2915

Closed
xzcvczx opened this issue Jul 20, 2017 · 29 comments
Closed

Change default editor to in-terminal #2915

xzcvczx opened this issue Jul 20, 2017 · 29 comments

Comments

@xzcvczx
Copy link

xzcvczx commented Jul 20, 2017

Or propose a feature:

As brew is primarily interfaced with from terminal would it not make more sense for the hardcoded default text editor to be one that also runs in the terminal? I am aware that it is easy to change the default.

As there are many casual users of brew who likely just want to check something in a recipe they likely expect it to just open inside of the terminal window, and for those who do a lot of editing/creating of recipes they likely expect to change settings for their preferred choice of editor.

@ilovezfs
Copy link
Contributor

The default is vim, which runs in the terminal, so I don't think I understand your proposal.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

well for me with no $HOMEBREW_EDITOR and no $EDITOR set it is defaulting to atom with

Editing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-science/wopr.rb
Warning: Using atom because no editor was set in the environment.
This may change in the future, so we recommend setting EDITOR,
or HOMEBREW_EDITOR to your preferred text editor.

showing up. it is only in the last couple of days it has changed from vim and i have no idea why

@ilovezfs
Copy link
Contributor

env | grep atom

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

Air:Homebrew simon$ env | grep atom Air:Homebrew simon$

@ilovezfs
Copy link
Contributor

Can you please post the output of brew config?

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

HOMEBREW_VERSION: 1.2.4-83-gf8300b2
ORIGIN: https://github.com/Homebrew/brew
HEAD: f8300b2cb720ca0c25c6b8fbee2df84b5a210b2a
Last commit: 29 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3779216243a3308f46beffff196fa5c9a121dab6
Core tap last commit: 28 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.11.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.5-x86_64
Xcode: 8.3.3
CLT: 8.3.2.0.1.1492020469
X11: 2.7.9 => /opt/X11

@ilovezfs
Copy link
Contributor

Please try this:

cd /usr/local/Homebrew
git reset --hard HEAD^
export HOMEBREW_UPDATE_TO_TAG=1
brew update

Then please post brew config, and try the brew edit again.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

HOMEBREW_VERSION: 1.2.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: b5529084906af89827f6d9befd613457a1615918
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: c979a4ae68cbc88a98765fa4bd239e5fe0b5794f
Core tap last commit: 7 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.0.0-p648
Clang: 8.1 build 802
Git: 2.11.0 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.5-x86_64
Xcode: 8.3.3
CLT: 8.3.2.0.1.1492020469
X11: 2.7.9 => /opt/X11

same result defaulted to atom

486d3d8 is likely the commit that is causing the issue as i do not have any of the previous-to-commit editors installed

@ilovezfs
Copy link
Contributor

Ah, yeah, that seems likely. I think you'll need to set HOMEBREW_EDITOR=vim in that case since this behavior is intentional.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

hence the bug report proposal to make the default in-terminal.

to get back to normal usage of brew do i just unset HOMEBREW_UPDATE_TO_TAG and brew update?

@ilovezfs
Copy link
Contributor

Yes.

@vitorgalvao
Copy link
Member

Considering how hard it is to exit vim if you don’t know how, making it the default is not a really user-friendly idea. And which other CLI editor would be appropriate? nano? Very few people would be happy with that as well.

Even amongst developers and technical users, there’s a common fear and misticism of the command-line. Many can use Homebrew due to its convenience but are not well-versed in much more.

Having popular GUI editors that people know is the most sensible default. Changing defaults is an advanced feature, as is using an advanced editor. If you use vim, you know how to change a default. If you use atom, you might not.

@ilovezfs
Copy link
Contributor

On the flip side, it is really jarring to have brew edit launch a GUI by default and when you exit, you have to find your way back to the relevant Terminal window.

@apjanke
Copy link
Contributor

apjanke commented Jul 20, 2017

I sympathize with both those points - hard to exit vim, and a little odd to pop up an external editor since brew is terminal-based.

What do folks think of defaulting to nano or pico instead? They ship with macOS and are quite user friendly.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

while i am a vim user i realise that most are not, but i think nano/pico are much saner defaults than a gui editor

@DomT4
Copy link
Member

DomT4 commented Jul 20, 2017

Oh lord, I remember trying to work out how to escape vim years back. For a while I genuinely used to open up another terminal tab & execute killall vim 😅.

nano seems like a sensible suggestion to me, FWIW; it's very user-friendly.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

as long as you know what '^' stands for

@apjanke
Copy link
Contributor

apjanke commented Jul 20, 2017

c343dfc0752f238886bee7c2f44dc753

(I am also a vim user.)

@vitorgalvao
Copy link
Member

as long as you know what '^' stands for

Yep. And that is not exactly obvious either. But my main issue with nano or pico is that they’re defaults no one™ will ever want. At least atom is used by many people.

Unless more users complain, I see no reason to change the default — it’s a good one. A single user complaint from someone who can change the default, and in which changing the default is part of features of the program, is hardly a compelling basis to make the switch. Otherwise we’ll just bikeshed which limited-CLI-editor-no-one-really-uses-regulalry-and-will-want-to-change-right-away to use.

@ilovezfs
Copy link
Contributor

We don't really get any complaints from people about the default being vim, and most users do not have one of the "chosen" GUI editors installed, so I'm not sure why vim wouldn't be a satisfactory default.

@vitorgalvao
Copy link
Member

We don't really get any complaints from people about the default being vim

We don’t. StackOverflow does.

I'm not sure why vim wouldn't be a satisfactory default.

Because you care about user experience, and having people stuck on a step and unable to exit makes them feel bad unnecessarily.

@ilovezfs
Copy link
Contributor

StackOverflow is not evidence of a problem if we're not actually getting any complaints.

@ilovezfs
Copy link
Contributor

What is particularly unfriendly about the current behavior is that if you use brew edit over ssh it will still launch the atom GUI.

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

that is definitely a problem

@MikeMcQuaid
Copy link
Member

I'd like to see the current behaviour remain as-is (as it has been pretty much as long as Homebrew has existing) until we get many, many more complaints. Changing the current defaults will surprise everyone who relies on it whereas @xzcvczx now has a solution to their problem.

What is particularly unfriendly about the current behavior is that if you use brew edit over ssh it will still launch the atom GUI.

This isn't great behaviour and we can handle it by checking for ENV["SSH_CONNECTION"] or similar and changing the editor accordingly.

@ilovezfs
Copy link
Contributor

This isn't great behaviour and we can handle it by checking for ENV["SSH_CONNECTION"] or similar and changing the editor accordingly.

👍

@xzcvczx
Copy link
Author

xzcvczx commented Jul 20, 2017

i am curious as to whether it is people liking or even being aware of the behaviour when if they don't have any of the mentioned apps installed its just falling back to vim anyway, so (not saying it is) but vim might be the primary editor that people use by default anyway.

@MikeMcQuaid
Copy link
Member

i am curious as to whether it is people liking or even being aware of the behaviour when if they don't have any of the mentioned apps installed its just falling back to vim anyway, so (not saying it is) but vim might be the primary editor that people use by default anyway.

A lot of people do have the mentioned apps installed and changing the default to vim will break it for those people and therefore is not an option.

@MikeMcQuaid
Copy link
Member

Passing on this for now.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants