Show user's $EDITOR in output

It looks nicer with confirmation and also checks the user actually has an
$EDITOR.
This commit is contained in:
mcarton
2015-07-29 18:35:59 +02:00
parent e4b97af73e
commit de513cacb1
2 changed files with 16 additions and 4 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import re
import os
from thefuck.utils import memoize
from thefuck import shells
@@ -49,7 +50,7 @@ def _search(stderr):
def match(command, settings):
return _search(command.stderr)
return 'EDITOR' in os.environ and _search(command.stderr)
def get_new_command(command, settings):
@@ -57,5 +58,5 @@ def get_new_command(command, settings):
# Note: there does not seem to be a standard for columns, so they are just
# ignored for now
return shells.and_('$EDITOR {} +{}'.format(m.group('file'), m.group('line')),
return shells.and_('{} {} +{}'.format(os.environ['EDITOR'], m.group('file'), m.group('line')),
command.script)