Browse Source

xontrib z: set $_Z_EXCLUDE_DIRS instead of mocking ZHandler.add

requires fix for issue https://github.com/astronouth7303/xontrib-z/issues/8

possible fix: https://github.com/fphammerle/xontrib-z/commit/6a5ff1af723cd3ce9001d24d0a30e733ddd47461
Fabian Peter Hammerle 5 years ago
parent
commit
486650c925
1 changed files with 1 additions and 11 deletions
  1. 1 11
      rc.xsh

+ 1 - 11
rc.xsh

@@ -3,20 +3,10 @@ $AUTO_PUSHD = True
 $XONSH_AUTOPAIR = True
 # tab selection: do not execute cmd when pressing enter
 $COMPLETIONS_CONFIRM = True
+$_Z_EXCLUDE_DIRS = ['/tmp']
 
 xontrib load vox z
 
-# mock ZHandler.add to keep it from adding dirs in /tmp
-ZHandler = aliases['z'].__self__ if 'z' in aliases else None
-if ZHandler:
-    ZHandler_add = ZHandler.add
-    def zhandler_add_mock(self, path):
-        if not path.startswith('/tmp'):
-            ZHandler_add(self, path)
-        else:
-            print('z ignore', path)
-    ZHandler.add = zhandler_add_mock
-
 def _last_exit_status():
     try:
         exit_status = __xonsh_history__.rtns[-1]