We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
git-plan looks for the user's choice of editor through an environment variable named EDITOR and if such a variable doesn't exist, it defaults to vim.
git-plan
EDITOR
vim
git users have their choice of editor pre-configured which can be found by running git config --global core.editor. Consider using this configuration.
git
git config --global core.editor
Reduces the effort for users in having to setup a new environment variable when one already exists in the git domain.
Look up the result of git config --global core.editor and default to vim if variable is not set.
The text was updated successfully, but these errors were encountered:
EDITOR is a pretty ubiquitous env var, but here's a first pass (since there's only one place an editor is looked for):
diff --git a/git_plan/service/plan.py b/git_plan/service/plan.py index cb60191..8ba2bfb 100644 --- a/git_plan/service/plan.py +++ b/git_plan/service/plan.py @@ -4,9 +4,9 @@ """ import os import tempfile import time -from subprocess import call +from subprocess import call, getoutput from typing import List from git_plan.exceptions import PlanEmpty from git_plan.model.commit import Commit, CommitMessage @@ -87,9 +87,11 @@ class PlanService: def _prompt_user_for_plan(self, initial: str = None) -> CommitMessage: if not initial: initial = self._plan_template - editor = os.environ.get('EDITOR', 'vim') + editor = getoutput('git config --global core.editor') + if not editor: + editor = os.environ.get('EDITOR', 'vim') if not is_installed(editor): raise RuntimeError("Couldn't find an editor installed on your system.") with tempfile.NamedTemporaryFile(suffix=".tmp", mode='r+') as file:
Sorry, something went wrong.
This sounds reasonable, it makes sense to use existing git configuration wherever possible.
I'm happy to take a PR for this but the subprocess call should be a method in the GitService.
GitService
Fixed in #85, so closing this issue.
No branches or pull requests
Current Situation
git-plan
looks for the user's choice of editor through an environment variable namedEDITOR
and if such a variable doesn't exist, it defaults tovim
.Enhancement
git
users have their choice of editor pre-configured which can be found by runninggit config --global core.editor
. Consider using this configuration.Reasoning
Reduces the effort for users in having to setup a new environment variable when one already exists in the
git
domain.Implementation
Look up the result of
git config --global core.editor
and default tovim
if variable is not set.The text was updated successfully, but these errors were encountered: