Closed zw963 closed 1 year ago
This is consider as a bug, i thought i can try fix this with a PR.
Hey, thanks for reporting. I don't think we account for $EDITOR
anywhere. To change the editor you need to --editor=xyz
flag https://github.com/luckyframework/lucky/blob/88f9562a5d69dd9c90af03967757daeed376af17/tasks/exec.cr#L8
We actually don't use the original Cry version, we have a forked version here: https://github.com/luckyframework/cry
If you wanted to submit a PR, this should be easy to change...
I think this just needs to be ENV["EDITOR"]? || editor || settings.editor
I think this just needs to be
ENV["EDITOR"]? || editor || settings.editor
No, we should respect user provided editor with "-e", i consider we should add it as a default value instead at https://github.com/luckyframework/lucky/blob/88f9562a5d69dd9c90af03967757daeed376af17/tasks/exec.cr#L16
I don't think we account for $EDITOR anywhere.
But, if i am not misunderstood, you means, lucky never accept this EDITOR PR, right? i consider force all user to use Vim is not a good idea.
You're not forced to use Vim, that's just the default. Right now there's 2 options:
lucky exec -e emacs
config/editor.cr
# config/editor.cr
Lucky::Exec.configure do |setting|
setting.editor = ENV["EDITOR"]? || "emacs"
end
The Lucky code doesn't use $EDITOR
anyway currently, but I'm ok with adding it. I don't think it should be default though. Or, if we do make it default, we need a fallback. setting editor : String = ENV["EDITOR"]? || "vim"
How about we do editor_to_use = editor || ENV["EDITOR"]? || settings.editor
? Then the flag comes first, then ENV, then the default if nothing else is specified.
Or, if we do make it default, we need a fallback.
setting editor : String = ENV["EDITOR"]? || "vim"
Yes, this exactly what i means.
How about we do
editor_to_use = editor || ENV["EDITOR"]? || settings.editor
? Then the flag comes first, then ENV, then the default if nothing else is specified.
I consider this same as setting editor : String = ENV["EDITOR"]? || "vim"
. :smile:
Describe the bug
Expected behavior It should respect my $EDITOR environment variable. as almost most of tools which depend on this.
e.g. git, original cry
For now, i have to install vim to make
lucky exec
work. but, i use prefer to use emacs.Versions (please complete the following information):
crystal --version
):LLVM: 10.0.0 Default target: x86_64-unknown-linux-gnu