-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
make editor selection aware of VISUAL env variable #51991
Conversation
This will require a changelog fragment in |
9edb642
to
12e7125
Compare
The test
|
Vault editor should prefer editor set in VISUAL env variable and only then fallback to EDITOR. For more background, check: https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference
12e7125
to
7f27f7b
Compare
The test
|
env_editor = os.environ.get('VISUAL') | ||
if not env_editor: | ||
env_editor = os.environ.get('EDITOR', 'vi') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have used EDITOR
historically, we should not change the default and need to start with EDITOR
as the default. This precedence may not make sense, though, and we may need to add a config option to control this.
env_editor = os.environ.get('VISUAL') | |
if not env_editor: | |
env_editor = os.environ.get('EDITOR', 'vi') | |
env_editor = os.environ.get('EDITOR', os.environ.get('VISUAL', 'vi')) |
needs_info |
@zmyrgel This pullrequest is waiting for your response. Please respond or the pullrequest will be closed. |
@zmyrgel You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information. |
Vault editor should prefer editor set in VISUAL env variable and only then fallback to EDITOR.
SUMMARY
When ansible-vault command opens editor it first looks for editor set in EDITOR env variable and falls back to vi if EDITOR is not set.
This fixes it so that it first looks for editor in set in VISUAL env variable, then in EDITOR and finally falls back to vi.
For background info:
https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference
ISSUE TYPE
COMPONENT NAME
parsing
ADDITIONAL INFORMATION
Following should open ansible vault file in emacs after the change.