def install_editor(template, wait=False):
 def call_editor(self, filename, line=0):
  if (line is None):
   line = 0
  cmd = template.format(filename=pipes.quote(filename), line=line)
  print ('>', cmd)
  if sys.platform.startswith('win'):
   cmd = shlex.split(cmd)
  proc = subprocess.Popen(cmd, shell=True)
  if (wait and (proc.wait() != 0)):
   raise TryNext()
  if wait:
   py3compat.input('Press Enter when done editing:')
 get_ipython().set_hook('editor', call_editor)
 get_ipython().editor = template

def install_editor ( template , wait = False ) : def call_editor ( self , filename , line = 0 ) : if ( line is None ) : line = 0 cmd = template . format ( filename = pipes . quote ( filename ) , line = line ) print ( '>' , cmd ) if sys . platform . startswith ( 'win' ) : cmd = shlex . split ( cmd ) proc = subprocess . Popen ( cmd , shell = True ) if ( wait and ( proc . wait ( ) != 0 ) ) : raise TryNext ( ) if wait : py3compat . input ( 'Press Enter when done editing:' ) get_ipython ( ) . set_hook ( 'editor' , call_editor ) get_ipython ( ) . editor = template
installs the editor that is called by ipython for the %edit magic .