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

Add alternate_editor config option to specify an editor. #1350

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

bossstein
Copy link

Description

Solution to issue #1342 . This change adds an alternate_editor config option. Previous functionality was to check the $VISUAL environment variable and use this and then if this is blank it would use $EDITOR. These environment variables are used by other software and as such a user may not want to change them, however they may want to not use a visual editor in pgcli or they may want to use a different editor to the default. By adding this alternate editor option a user can choose a different editor and even specify arguments if they want to use different editor behaviour while in pgcli.

Checklist

  • I've added this contribution to the changelog.rst.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install), and ran black on my code.
  • Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)

bossstein and others added 9 commits June 18, 2022 11:18
I use gvim. Gvim has a slighltly strange functionality where it immedietly forks when run. This
means it isn't functional for use with the \e command. By allowing the user to select a different
editor they can use some other editor without changing their VISUAL variable they can for example
set the config option to 'gvim --nofork' to get the desired functionality.
@bossstein
Copy link
Author

@j-bennet can you check this pr when it's convenient.

Copy link
Contributor

@j-bennet j-bennet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, except I'd leave the config option empty, instead of default.

# When set to a non default value, the chosen editor will be used when opening an
# editor with \e. Otherwise, if default is selected, the enviroment variable VISUAL
# is used. If VISUAL is blank then enviroment variable EDITOR is used.
alternate_editor = default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why default and not just leave it empty?

@j-bennet
Copy link
Contributor

@bossstein Do you plan to continue working on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants