Update: The first answer (below) does not accept parameters. Therefore, put this snippet at the end of ipy_user_conf.py (it is located in your home directory).
def ed_xed(self,arg): ip = self.api return ip.magic.im_class.magic_edit(ip.IP," -x %s "%arg) ip.expose_magic('xed',ed_xed)
Before the upgrade: Should it be% magic? You can use a macro and store magic to reproduce this behavior without% magic.
In [5]: %edit -x In [6]: macro xed 5 In [7]: store xed In [8]: xed
for the magic alias from the documentation (% magic?):
You can also define your own alias names for magic functions. In your ipythonrc, putting the line as:
execute IPYTHON .magic_pf = IPython .magic_profile
will define% pf as the new name for% Profile.
But I do not know how to add a parameter.
source share