From 2ff74723f52a5f5d602c8d9b84bcdcaf21c7478d 2013-04-08 11:31:36 From: Anders Hovmöller Date: 2013-04-08 11:31:36 Subject: [PATCH] Default color output for ls on OSX Fixed incorrect overriding of ls alias on OSX which prevented producing color output --- diff --git a/IPython/core/alias.py b/IPython/core/alias.py index a9bb0d6..ce355b4 100644 --- a/IPython/core/alias.py +++ b/IPython/core/alias.py @@ -72,17 +72,17 @@ def default_aliases(): ] else: # BSD, OSX, etc. - ls_aliases = [('ls', 'ls -F'), + ls_aliases = [('ls', 'ls -F -G'), # long ls - ('ll', 'ls -F -l'), + ('ll', 'ls -F -l -G'), # ls normal files only - ('lf', 'ls -F -l %l | grep ^-'), + ('lf', 'ls -F -l -G %l | grep ^-'), # ls symbolic links - ('lk', 'ls -F -l %l | grep ^l'), + ('lk', 'ls -F -l -G %l | grep ^l'), # directories or links to directories, - ('ldir', 'ls -F -l %l | grep /$'), + ('ldir', 'ls -F -G -l %l | grep /$'), # things which are executable - ('lx', 'ls -F -l %l | grep ^-..x'), + ('lx', 'ls -F -l -G %l | grep ^-..x'), ] default_aliases = default_aliases + ls_aliases elif os.name in ['nt', 'dos']: @@ -255,7 +255,7 @@ class AliasManager(Configurable): if l2.split(None,1)[0] == line.split(None,1)[0]: line = l2 break - line=l2 + line = l2 else: break diff --git a/IPython/core/magics/osm.py b/IPython/core/magics/osm.py index cbba198..071a614 100644 --- a/IPython/core/magics/osm.py +++ b/IPython/core/magics/osm.py @@ -182,8 +182,9 @@ class OSMagics(Magics): try: # Removes dots from the name since ipython # will assume names with dots to be python. - self.shell.alias_manager.define_alias( - ff.replace('.',''), ff) + if ff not in self.shell.alias_manager: + self.shell.alias_manager.define_alias( + ff.replace('.',''), ff) except InvalidAliasError: pass else: