Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Fix up the history upon "fg"



On Apr 9,  9:43pm, Felix Rosencrantz wrote:
} Subject: Re: Fix up the history upon "fg"
}
} That's a pretty useful function. I guess I would sort of also like the
} inverse function, you type a command, and if the same command line is
} already running (including same CWD) the shell does a fg rather than
} run the command.

A slightly extended version of `setopt auto_resume'.

You'd need to have preexec stash the command line for you somewhere, so
that you could compare against $jobtexts inside the wrapper function.  You
need the alias-expanded command line (see Wayne's recent patch in 13933).

} It would be nice if zsh could store the CWD information along with the
} history.

Cutesy trick:

    precmd() {
	local bufstack
	read -z bufstack && print -z "$bufstack" || print -z ": $PWD; "
    }

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author