2012/12/22 Martin Bähr <mba...@email.archlab.tuwien.ac.at>: > On Sat, Dec 22, 2012 at 02:15:29AM +0800, Cheer Xiao wrote: >> The the availability of latest history item before it is executed is >> crucial to the filename saving part of a fasd-like tool. Assuming a >> preexec event implemented, it will look like: >> >> function parse_and_save -e preexec >> eval set args (echo $history[1] | tr \;\n ' ') >> for a in $args >> if test -f $a >> save (readlink -f $a) >> end >> end >> end > > does it has to come from the history or could the commandline be made > available through other ways?
After thinking about it, retrieving the command list from $history[1] is not ideal. A better approach is to call the hook before executing each *job* (but after it's parsed) instead of after the user commits a line, so that when a user types "echo a; echo b" and hit Enter, the hook is executed *twice*. The job's argument list should be also available. Brain dump: https://github.com/fish-shell/fish-shell/issues/477 I will attempt this when I have time. :) -- Regards, Cheer Xiao ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Fish-users mailing list Fish-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/fish-users