Relax editor templating
I tried to set my editor to `termite -e "vim -f {}"`, termite being a pretty cool and light terminal I use within my i3wm Arch linux box. So when I open my editor I want it to launch a terminal with Vim inside instead of GVim for various reasons. The validation rejected this at first because it was looking for '{}' inside ['foo', 'bar', 'baz {}'], essentially. So I need it to look inside the sub-strings, not just the list. Then after validation I need to perform the '{}' replacement inside the sub-string too, not just replacing the whole string.
This commit is contained in:
parent
8e5014fc0f
commit
e9128ebb2a
@ -1094,7 +1094,7 @@ class ShellCommand(BaseType):
|
||||
shlex.split(value)
|
||||
except ValueError as e:
|
||||
raise configexc.ValidationError(value, str(e))
|
||||
if self.placeholder and '{}' not in self.transform(value):
|
||||
if self.placeholder and '{}' not in value:
|
||||
raise configexc.ValidationError(value, "needs to contain a "
|
||||
"{}-placeholder.")
|
||||
|
||||
|
@ -124,6 +124,6 @@ class ExternalEditor(QObject):
|
||||
self._proc.error.connect(self.on_proc_error)
|
||||
editor = config.get('general', 'editor')
|
||||
executable = editor[0]
|
||||
args = [self._filename if arg == '{}' else arg for arg in editor[1:]]
|
||||
args = [arg.replace('{}', self._filename) if '{}' in arg else arg for arg in editor[1:]]
|
||||
log.procs.debug("Calling \"{}\" with args {}".format(executable, args))
|
||||
self._proc.start(executable, args)
|
||||
|
Loading…
Reference in New Issue
Block a user