Skip to content

Commit e13e7ed

Browse files
committed
config -e: Parse arguments in $EDITOR (fix #1200)
1 parent 1f3fc60 commit e13e7ed

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

beets/ui/commands.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import codecs
2424
import platform
2525
import re
26+
import shlex
2627

2728
import beets
2829
from beets import ui
@@ -1503,7 +1504,12 @@ def config_edit():
15031504

15041505
if 'EDITOR' in os.environ:
15051506
editor = os.environ['EDITOR']
1506-
args = [editor, editor, path]
1507+
try:
1508+
editor = shlex.split(editor)
1509+
except ValueError: # Malformed shell tokens.
1510+
editor = [editor]
1511+
args = editor + [path]
1512+
args.insert(1, args[0])
15071513
elif platform.system() == 'Darwin':
15081514
args = ['open', 'open', '-n', path]
15091515
elif platform.system() == 'Windows':

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Fixed:
6868
twice in the artist string. Thanks to Marc Addeo. :bug:`1179` :bug:`1181`
6969
* :doc:`/plugins/lastgenre`: Match songs more robustly when they contain
7070
dashes. Thanks to :user:`djl`. :bug:`1156`
71+
* The :ref:`config-cmd` command can now use ``$EDITOR`` variables with
72+
arguments.
7173

7274
.. _API changes: http://developer.echonest.com/forums/thread/3650
7375
.. _Plex: https://plex.tv/

0 commit comments

Comments
 (0)