source-bash ~/.envrc --overwrite-aliases # Zoxide execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') xontrib load coreutils xontrib load vox xontrib load autovox xontrib load prompt_starship xontrib load bashisms xontrib load sh # TODO: Does this work? def yy(args=None): import tempfile """ Yazi file manager wrapper that follows directory changes. Usage: y() or y('some/path') """ with tempfile.NamedTemporaryFile(prefix='yazi-cwd.', suffix='.tmp') as tmp: # Build command arguments cmd_args = ['yazi'] if args: cmd_args.append(str(args)) cmd_args.append(f'--cwd-file={tmp.name}') # Run yazi @(cmd_args) # Read new working directory try: with open(tmp.name) as f: new_cwd = f.read().strip() # Change directory if valid and different if new_cwd and os.path.isdir(new_cwd) and new_cwd != os.getcwd(): cd @(new_cwd) except (IOError, OSError): pass